public void ProcessRequest(WebContext <T> webContext, ISharpboxController <T> controller) { try { this.HandleRequest(webContext, controller); this.PopulateLifeCycleTrail(webContext); } catch (Exception ex) { if (webContext.WebResponse == null) { webContext.WebResponse = new WebResponse <T>() { ModelErrors = new Dictionary <string, Stack <ModelError> >() }; } this.AddModelStateError(webContext, controller, "ExecutionError", new ModelError(ex, ex.Message)); } if (this._successor != null && controller.IsModelStateValid()) { this._successor.ProcessRequest(webContext, controller); } }
public override void HandleRequest(WebContext <T> webContext, ISharpboxController <T> controller) { if (!controller.IsModelStateValid()) { controller.MigrateModelErrorsToWebContext(); return; } this.Validator = controller.LoadValidatorByUiAction(webContext.WebRequest.UiAction); if (!this.Validate(webContext.WebRequest)) { webContext.WebResponse.Instance = webContext.WebRequest.Instance; foreach (var e in this.ValidationResult.Errors) { AddModelStateError(webContext, controller, e.PropertyName, new ModelError(e.ErrorMessage)); } } }