public ActionResult Edit([Bind(Include = "Id,Name,Abrv")] VehicleMakeViewModel vehicleMakeVM) { if (ModelState.IsValid) { VehicleMake vehicleMake = Mapper.Map <VehicleMake>(vehicleMakeVM); vehicleMakeLogic.UpdateVehicleMake(vehicleMake); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Update([Bind(Include = "Id,Name,Abrv")] MakeViewModel make) { try { if (ModelState.IsValid) { vehicleMakeService.UpdateVehicleMake(AutoMapper.Mapper.Map <VehicleMake>(make)); return(RedirectToAction("VehicleMakeList")); } } catch (DataException) { ModelState.AddModelError("", "Something went wrong! Can't update VehicleMake."); } return(RedirectToAction("Update", make.Id)); }