public ActionResult Detail(long Id) { Models.FeedbackVM feedbackVM = new Models.FeedbackVM(); if (Id.ToString() == null) { return(RedirectToAction("Error", "Error")); } DataAccess.Models.GasStation gasStation = new DataAccess.Models.GasStation(); gasStation = _gasStationRepository.FindById(Id); if (gasStation == null) { return(RedirectToAction("NotFound", "Error")); } feedbackVM.GasStationName = gasStation.GasStationName; List <DataAccess.Models.GasStationGasType> listgasType = new List <DataAccess.Models.GasStationGasType>(); listgasType = _gasStationGasTypeRepository.GetAll().Where(x => x.GasStationId == Id).ToList(); foreach (var item in listgasType) { if (feedbackVM.GasType == null) { feedbackVM.GasType += _mTpyeRepository.getTypeText(item.GasType, 3); } else { feedbackVM.GasType += ", " + _mTpyeRepository.getTypeText(item.GasType, 3); } } feedbackVM.GasAddress = gasStation.Address + ", " + _districtRepository.FindById(gasStation.District).DistrictName; feedbackVM.OpenTime = gasStation.OpeningTime; feedbackVM.Rating = _mTpyeRepository.getTypeText(gasStation.Rating, 4); ViewBag.countPage = _feedbackRepository.GetAll().Where(x => x.GasStationId == Id).Count(); return(View(feedbackVM)); }