Esempio n. 1
0
 public static double Quote(Car car, DateTime? StartDate, DateTime? EndDate)
 {
     int days = DaysRented(StartDate, EndDate);
     if (days <= 0)
         return 0;
     return car.CarType.DailyPrice * days;
 }
Esempio n. 2
0
        public ActionResult Create(Car car)
        {
            if (ModelState.IsValid)
            {
                db.Cars.Add(car);
                db.SaveChanges();
                TempData["Added"] = car.Description + " Added";
                return RedirectToAction("Index");
            }

            ViewBag.BranchId = new SelectList(db.Branches, "BranchId", "Description", car.BranchId);
            ViewBag.CarTypeId = new SelectList(db.CarTypes, "CarTypeId", "CarCode", car.CarTypeId);
            ViewBag.CarModelId = new SelectList(db.CarModels, "CarModelId", "Description", car.CarModelId);
            return View(car);
        }