I can not solve one problem, because I have a bad understanding of ViewModel .
I have two models. This is a type of accounting unit.
public class Ue_type { [Display(Name = "ID")] [Key] public int Id { set; get; } [Display(Name = "Тип")] [StringLength(200)] [Column(TypeName = "char")] public string Type_Name { set; get; } } And this is a unit of account model
public class Ue_model { [Display(Name = "ID")] [Key] public int Id { set; get; } [Display(Name = "Модель УЕ")] [StringLength(200)] [Column(TypeName = "char")] public string Model_Name { set; get; } public int UetypeId { set; get; } } In the type we write for example Monitor, Laptop, Printer, etc. ... And in the model we describe the model Samsung S22 plus a type identifier 1.
So I want to bring this whole thing to View . In this form
[__Модель____][__Тип____] [Samsung S22 ][ Монитор ] [Kyocera 102 ][ Принтер ] I made a controller
public ActionResult Ue_Models() { var model_res = (from m in db.Ue_model join t in db.Ue_type on m.UetypeId equals t.Id select new { m.Model_Name, t.Type_Name }).ToList(); return View(model_res); } Correctly, I combined the two models using LINQ ? And how do I now bring all this to View . And if possible, give an example of a ViewModel I really want to look at ViewModel with this example.