public ActionResult Update(ManifacturerViewModel model) { if (!ModelState.IsValid) { Helpers.InvalidModelState(ModelState); } _manifacturerService.Update(model); return(Json(true)); }
public static ManifacturerViewModel MapToViewModel(this Manifacturer manifacturer) { var viewModel = new ManifacturerViewModel(); viewModel.Id = manifacturer.Id; viewModel.Name = manifacturer.Name; viewModel.City = manifacturer.City; viewModel.Country = manifacturer.Country; viewModel.Address = manifacturer.Address; return(viewModel); }
public void Update(ManifacturerViewModel model) { _unitOfWork.BeginTransaction(); var manifacturer = _manifacturerRepository.GetById(model.Id); if (manifacturer == null) { _unitOfWork.Commit(); throw new Exception(ExceptionMessages.ManifacturerException.NOT_FOUND); } manifacturer.Address = model.Address; manifacturer.Country = model.Country; manifacturer.City = model.City; manifacturer.Name = model.Name; _manifacturerRepository.Update(manifacturer); _unitOfWork.Commit(); }