public ActionResult Edit(Variant editedVariant) { string pageAction = "Edit"; try { if (ModelState.IsValid) { _vRepository.Edit(editedVariant); return(RedirectToAction(pageAction, new { id = editedVariant.Id, fromSave = "Saved" })); } returnModelToEdit(pageAction); return(View(pageAction, editedVariant)); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); returnModelToEdit(pageAction); return(View(pageAction, editedVariant)); } }