public ActionResult Create(TitleEditViewModel tevm) { var out_tevm = CreateViewModel <TitleEditViewModel>(); out_tevm.Title = tevm.Title; string err_msg = string.Empty; if (ModelState.IsValid) { try { _titleService.CreateTitle(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 ? ViewResources.SharedStrings.DataSavingMessage : err_msg, DisplayMessage = !string.IsNullOrEmpty(err_msg), viewData = ModelState.IsValid ? null : this.RenderPartialView("Create", out_tevm) })); }