コード例 #1
0
ファイル: CarsController.cs プロジェクト: nasro10/Location
        public ActionResult CarDetail(int id)
        {
            Car car = myService.GetById(id);

            ViewBag.note  = serviceRating.avgRate(car);
            ViewBag.note1 = serviceRating.avgRateUser(car.User);
            return(View(car));
        }
コード例 #2
0
        public ActionResult CarCat(int id, int?page)
        {
            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            var res1 = serviceCar.GetMany().Where(x => x.SubCategoryId == id && x.Active == true).ToList();

            foreach (var c in res1)
            {
                ViewBag.note = serviceRating.avgRate(c);
            }
            return(View(res1.ToPagedList(pageNumber, pageSize)));
        }
コード例 #3
0
ファイル: CarController.cs プロジェクト: nasro10/Location
        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));
        }