예제 #1
0
        public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
        {
            if (_notificationContext.HaveNotification())
            {
                context.HttpContext.Response.StatusCode  = (int)HttpStatusCode.BadRequest;
                context.HttpContext.Response.ContentType = "application/json";
                var erros = JsonConvert.SerializeObject(_notificationContext.GetErrors());
                await context.HttpContext.Response.WriteAsync(erros);

                return;
            }

            await next();
        }