public ActionResult Edit(TitleEditViewModel tevm) { var out_tevm = CreateViewModel <TitleEditViewModel>(); out_tevm.Title = tevm.Title; string err_msg = string.Empty; if (ModelState.IsValid) { try { _titleService.EditTitle((int)tevm.Title.Id, tevm.Title.Name, tevm.Title.Description, tevm.Title.CompanyId); } catch (Exception ex) { err_msg = ex.Message; ModelState.AddModelError("", err_msg); } } else { var companies = GetCompanies(); out_tevm.Companies = new SelectList(companies, "Id", "Name"); } return(Json(new { IsSucceed = ModelState.IsValid, Msg = ModelState.IsValid ? string.Format(ViewResources.SharedStrings.TitlesTitleSaving, tevm.Title.Name) : err_msg, DisplayMessage = !string.IsNullOrEmpty(err_msg), viewData = ModelState.IsValid ? null : this.RenderPartialView("Edit", out_tevm) })); }