public ActionResult Create(DisplayConfigurationViewModel displayConfigVm) { if (ModelState.IsValid) { try { this._repository.Create(displayConfigVm.Map <DisplayConfiguration>()); this._repository.Commit(); return(RedirectToAction(nameof(this.Index))); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } } return(View(displayConfigVm)); }
public ActionResult Edit(DisplayConfigurationViewModel displayConfigVm) { if (!ModelState.IsValid) { return(View(displayConfigVm)); } try { DisplayConfiguration disConfig = this._repository.Get(displayConfigVm.Id); displayConfigVm.Map(disConfig); this._repository.Commit(); return(RedirectToAction(nameof(this.Index))); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } return(View(displayConfigVm)); }