Пример #1
0
        public ActionResult Create(VehicleViewModel vehicle)
        {
            if (ModelState.IsValid)
            {
                vs.Insert(AutoMapper.Mapper.Map<VehicleViewModel, Vehicle>(vehicle));
                return RedirectToAction("Index");
            }

            return View(vehicle);
        }
Пример #2
0
        public ActionResult Edit(VehicleViewModel vehicle)
        {
            if (ModelState.IsValid)
            {
                AutoMapper.Mapper.CreateMap<VehicleViewModel, Vehicle>();
                vs.Update(AutoMapper.Mapper.Map<VehicleViewModel, Vehicle>(vehicle));
                return RedirectToAction("Index");
            }

            return View("Form", vehicle);
        }