Ejemplo n.º 1
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            var models  = context.GetLattiaModelArguments().Select(a => a.Value).ToList();
            var service = context.HttpContext.RequestServices.GetRequiredService <IPropertyGatesService>();

            var sanityErrors = service.CheckForErrors(models, ReadOnlyPropertyGate.Instance);

            if (sanityErrors.Any())
            {
                context.Result = new StatusCodeResult(400);
                return;
            }

            base.OnActionExecuting(context);
        }