public ActionResult CarDetail(int id) { Car car = myService.GetById(id); ViewBag.note = serviceRating.avgRate(car); ViewBag.note1 = serviceRating.avgRateUser(car.User); return(View(car)); }
public ActionResult EditCar(int id) { var res = serviceCarModel.GetMany().ToList(); var sub = serviceSubCategory.GetMany().ToList(); var year = serviceCreation.GetMany().ToList(); var type = serviceType.GetMany().ToList(); ViewBag.TypeId = new SelectList(type, "TypeId", "Name"); ViewBag.CreationYearId = new SelectList(year, "CreationYearId", "Name"); ViewBag.SubCategoryId = new SelectList(sub, "SubCategoryId", "Name"); ViewBag.CarModelId = new SelectList(res, "CarModelId", "Name"); Car car = myService.GetById(id); ViewBag.note = serviceRating.avgRate(car); ViewBag.note1 = serviceRating.avgRateUser(car.User); if (car == null) { return(HttpNotFound()); } return(View(car)); }