Ejemplo n.º 1
0
            public void OnActionExecuting(ActionExecutingContext context)
            {
                var personId   = (int)context.ActionArguments["id"];
                var personName = (string)context.ActionArguments["name"];

                if (!_service.DoesPersonExist(personId))
                {
                    context.Result = new NotFoundResult();
                }

                if (!_service.DoesNameMatch(personName))
                {
                    context.Result = new StatusCodeResult(404);//404 status code means request not found
                }
            }