// GET: Department public async Task <IActionResult> Index() { var model = new List <DepatViewModel>(); var departments = await dep.GetAllAsync(); foreach (var item in departments) { DepatViewModel depart = new DepatViewModel { Id = item.Id, Name = item.Name }; var totalclasse = cls.GetAll(); var totalcours = crs.GetAll(); depart.TotalClasses = totalclasse.Count(x => x.DepartmentID == depart.Id); depart.TotalCours = totalcours.Count(x => x.DepartmentID == depart.Id); model.Add(depart); } return(View(model)); }
public IActionResult Index(int id) { var session = _sessionService.GetAll(); var listingResult = session .Select(c => new SessionListingModel { Id = c.Id, SessionName = c.SessionName, SessionImageUrl = c.SessionImageUrl, ClassPriceNoMember = c.ClassPriceNoMember, ClassPriceMember = c.ClassPriceMember, }); var model = new SessionIndexModel() { SessionListing = listingResult }; return(View(model)); }