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