I'm building a form website using ASP.NET MVC and Entity Framework which collects information about companies (company_id
(PK), name, location, processes, etc).
I have two tables, first is for the company data and the second is for process data (company_id
(FK), process_id
(PK), process_name
, process_definition
).
Where I'm stuck is, all instances of all companies and processes are loaded in the website (I believe this will work terribly when more data is involved). I want to have a 2 step process where at first the user enters company data, and after that the company_id
is taken and the next page is the process data form, which is of the given company_id
.
After the first form is filled, I want to just deal with the given companies data, and not load all of the companies in the DbSet
. All of this is beyond my level of knowledge and I'm unable to articulate and find examples of what I want to do. I'm unable to share code snippets due to confidentiality. I'd appreciate if you can point me to similar projects or related resources.
I have tried to do what I can and currently I have two working forms for company and processes. It is working but not ideal, as stated above.
Edit:
CREATE TABLE [dbo].[Companies]
(
[CompanyID] [smallint] NOT NULL,
[CompanyName] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED ([CompanyID] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[Processes]
(
[ProcessNo] [smallint] NOT NULL,
[CompanyID] [smallint] NOT NULL,
[ProcessName] [nvarchar](max) NULL,
[Description] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED ([ProcessID] ASC, [ProcessNo] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Processes] WITH CHECK
ADD FOREIGN KEY([CompanyID]) REFERENCES [dbo].[Companies] ([CompanyID])
GO