public ActionResult Edit(ViewModelModel model) { var entity = Mapper.Map<ViewModelModel, Model>(model); ResponseMessage response = _modelService.Update(entity); if (response.IsError == true) { foreach (var item in response.ErrorCodes) { ModelState.AddModelError(item, item); } return View(model); } return RedirectToAction("Index"); }
public ActionResult Create(ViewModelModel model) { var entity = Mapper.Map<ViewModelModel, Model>(model); _modelService.Add(entity); return RedirectToAction("Index"); }