Click here to Skip to main content
14,845,770 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to add new record by codefirst.
I have 2 tables. material_tbl and DailyDetail_tbl. In DailyDetail_tbl, we enter amount of material which buy everyday.
I wants that user see the field material_name instead of material_id.
In this case, I must use from ViewModel.
I study and do many things for do it. But i couldn’t do it.
Please tell me all things step by step. From creating model until ViewModel and code of controller and view and …
Thanks very much

material_tbl :

DailyDetail_tbl :

What I have tried:

I don't know what should i do?
help please
Updated 9-Apr-20 11:27am

1 solution

What you should do is go through a tutorial to see how this is done
Tutorial: Get Started with Entity Framework 6 Code First using MVC 5 | Microsoft Docs[^]

After you can do that, then try it again with the data structures you want.
If you should encounter a problem then; please post the code you have and some detail on what the problem is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900