Exemplo n.º 1
0
        internal static JsonResult GetInvalidModelStateErrorResponse(ModelStateDictionary modelState)
        {
            var list = (from value in modelState from error in value.Value.Errors select error.ErrorMessage).ToList();
            var arg  = new AiurCollection <string>(list)
            {
                Code    = ErrorType.InvalidInput,
                Message = "Your input contains several errors!"
            };

            return(new JsonResult(arg));
        }
Exemplo n.º 2
0
        public static JsonResult GetInvalidModelStateErrorResponse(ModelStateDictionary modelstate)
        {
            var list = new List <string>();

            foreach (var value in modelstate)
            {
                foreach (var error in value.Value.Errors)
                {
                    list.Add(error.ErrorMessage);
                }
            }
            var arg = new AiurCollection <string>(list)
            {
                Code    = ErrorType.InvalidInput,
                Message = "Your input contains several errors!"
            };

            return(new JsonResult(arg));
        }