public override ActionResult CreateOperacion(GuiasBalancesModel model) { try { var a = 3; var modelview = Helper.fModel.GetModel <GuiasBalancesModel>(ContextService); model.GuiasBalancesLineas = GetListGuiasBalancesLineas.ToList(); using (var gestionService = createService(modelview)) { ((IToolbar)model).Toolbar = GenerateToolbar(gestionService, TipoOperacion.Alta, model); if (ModelState.IsValid) { gestionService.create(model); TempData[Constantes.VariableMensajeExito] = General.MensajeExitoOperacion; return(RedirectToAction("Index")); } } TempData["errors"] = string.Join("; ", ViewData.ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); TempData["model"] = model; return(RedirectToAction("Create")); } catch (Exception ex) { model.Context = ContextService; TempData["errors"] = ex.Message; TempData["model"] = model; return(RedirectToAction("Create")); } }
public override ActionResult EditOperacion(GuiasBalancesModel model) { var obj = model as IModelView; var objExt = model as IModelViewExtension; try { if (ModelState.IsValid) { using (var gestionService = createService(model)) { model.GuiasBalancesLineas = GetListGuiasBalancesLineas.ToList(); gestionService.edit(model); TempData[Constantes.VariableMensajeExito] = General.MensajeExitoOperacion; return(RedirectToAction("Index")); } } TempData["errors"] = string.Join("; ", ViewData.ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); TempData["model"] = model; //return base.EditOperacion(model); return(RedirectToAction("Edit", new { id = model.Id })); } catch (Exception ex) { model.Context = ContextService; TempData["errors"] = ex.Message; TempData["model"] = model; return(RedirectToAction("Edit", new { id = model.Id })); } }