示例#1
0
        public IActionResult ViewDetail(int id)
        {
            var detailView = (from st in studentRepository.Gets().ToList()
                              join cl in classRepository.Gets().ToList() on st.CategoryId equals cl.CategoryId
                              where cl.CategoryId == id
                              select new DetailViewModel()
            {
                Id = st.Id,
                nameCake = st.nameCake,
                ThanhPhan = st.ThanhPhan,
                Hsd = st.Hsd,
                Nsx = st.Nsx,
                GiaBan = st.GiaBan,
                DaXoa = st.DaXoa,
                CategoryId = st.CategoryId,
                CategoryName = cl.CategoryName
            }).ToList();

            return(View(detailView));
        }