public virtual async Task <ActionResult> Editor(TaxModel model, bool?saveAndContinue) { if (!ModelState.IsValid) { return(View(model)); } var record = _taxModelFactory.PrepareTblTaxes(model); var recordId = model.Id; try { if (model.Id == null) { //Add new record recordId = await _taxesService.AddAsync(record); } else { //Edit record await _taxesService.UpdateAsync(record); } await _localizedEntityService.SaveAllLocalizedStringsAsync(record, model); } catch (Exception e) { var errorCode = ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Error(e, System.Web.HttpContext.Current)); ModelState.AddModelError("", string.Format(_localizationService.GetResource("ErrorOnOperation"), e.Message, errorCode)); return(View(model)); } if (saveAndContinue != null && saveAndContinue.Value) { return(RedirectToAction("Editor", "ManageTaxes", new { id = recordId })); } return(Content(@"<script language='javascript' type='text/javascript'> window.close(); window.opener.refreshTaxesGrid(); </script>")); }