creating model class where IDs from multiple model class are required
I have a model class for Company Demographic Info
namespace myApp.Core.Models
{
public class FirmDemoGraphicInfoModels
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int FirmId { get; set; }
public string FirmName { get; set; }
public string FirmNumber { get; set; }
public string Address { get; set; }
}
}
another model class to for storing the services provided by different firms
namespace myApp.Core.Models
{
public class ServiceModels
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ServiceId { get; set; }
public string ServiceName { get; set; }
}
}
I have to create a table which can store the information of Company along with its service. One company will be registered for only one service. And the company will get serial registered id [FirmRegistrationNumber] generated from the system.
Attributes for the new table:
[FirmId],[ServiceId], [FirmRegistrationNumber]
How to create model class for this?
Also can I generate view page via entity framework such that to enter Firm Demographic Information and there should be dropdown for selecting Services in a single view page. Is it possible?