/// <summary> /// Method to persist object. /// </summary> internal virtual void Persist(SqlTransaction sqlTrans) { // see if there is exceptions in the business model RuleViolationException businessexception = this.BusinessExceptions; if (businessexception != null) { throw businessexception; } }
private Task HandleRuleViolationExceptionAsync(HttpContext context, RuleViolationException exception) { context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)HttpStatusCode.BadRequest; return(context.Response.WriteAsync(new ErrorDetails() { StatusCode = context.Response.StatusCode, ValidationErrors = exception.RuleViolations }.ToJson())); }
public override void When() { try { post.Validate(); } catch (RuleViolationException ex) { exception = ex; } }