public ActionResult Edit(int?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = service.Edit(Id); var viewModel = AutoMapper.Mapper.Map <VehicleModel, CreateVehicleModelViewModel>(model); if (viewModel == null) { return(HttpNotFound()); } return(View(viewModel)); }
public async Task <bool> EditVehicleModel(IVehicleModel vehicleModel) { try { await _vehicleModelRepository.Edit(vehicleModel); await _unitOfWork.SaveChangesAsync(); return(true); } catch { return(false); } }