private CheckAvailableViewModel GetRooms(int?categoryId, int?guests) { IEnumerable <Room> Info = new List <Room>(); if (guests == 0 || guests == null) { Info = reposity.GetByConditionIQueryable(a => a.IsDeleted == false && a.IsAvailable && a.CategoryID == categoryId).ToList(); } else { Info = reposity.GetByConditionIQueryable(a => a.IsDeleted == false && a.IsAvailable && a.CategoryID == categoryId && a.NumberOfPeople == guests).ToList(); } var category = categoriesRepository.GetByID(categoryId.Value); CheckAvailableViewModel viewModel = new CheckAvailableViewModel() { Image = category.Image, CateogyName = category.CategoryName, Rooms = Info }; return(viewModel); }
public ActionResult GetAvaliableRooms(int?categoryId, int?guests) { CheckAvailableViewModel viewModel = GetRooms(categoryId, guests); return(PartialView("_CategoryItem", viewModel)); }