Example #1
0
        public ActionResult Edit(EditVm model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            RentACarRepository repo = new RentACarRepository();

            RentACar item = new RentACar();

            item.Id          = model.Id;
            item.CarId       = model.CarId;
            item.PricePerDay = model.PricePerDay;
            item.Status      = model.Status;

            if (item.Id > 0)
            {
                repo.Update(item);
            }
            else
            {
                repo.Insert(item);
            }

            return(RedirectToAction("Index", "RentACar"));
        }