creating model class where IDs from multiple model class are required

arsar 121 Reputation points
2021-07-27T10:19:13.697+00:00

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?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,266 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,222 questions
{count} votes