Dear all I would like to ask a question I am having one property table in which I have (Id,Name,price,TypeID) TypeID is integer here and basically I have property type another table (id,type_name)
now when i am binding my viewmodel like
MYWM.Property=dbcontext.property.ToLuist(), it get all columns values from property table but the issue is for propertyID here i have id which I need to show property type name from property type table how to us include and add that column as well based in TypeID, in this line bcontext.property.ToLuist(), remember i have no forieng key specify only the matching thing is i have property type id in property table which mades with ID column of property type table
Tahir AnsariPosted Aug 7, 2024, 3:11 PM
Assume you have two entities: Property and PropertyType
Fetching Data with Navigation Property
Create a ViewModel (PropertyViewModel.cs) to hold the data you want to display in your view
Assume you have an ASP.NET Core MVC Controller where you want to use this method
Assuming you have a view to display the properties (Index.cshtml)
I hope this example resolved your issue
Happy coding!
Accept the answer if it is resolved your issue