public JsonResult Validate([ModelBinder(BinderType = typeof(NestedDataModelMultiTypeItemModelBinder))] NestedDataModelMultiTypeItem item)
        {
            if (item?.Model == null)
            {
                throw new Exception("Error binding model");
            }

            var errors = _modelValidationService.GetErrors(item.Model).ToList();

            return(_apiResponseHelper.SimpleCommandResponse(errors));
        }
Exemplo n.º 2
0
        public IHttpActionResult Delete()
        {
            _objectCacheFactory.Clear();

            return(_apiResponseHelper.SimpleCommandResponse(this, Enumerable.Empty <ValidationError>()));
        }
 /// <summary>
 /// Formats a command response wrapping it in a SimpleCommandResponse object and setting
 /// properties based on the presence of a validation error.
 /// </summary>
 /// <param name="validationErrors">Validation error, if any, to be returned.</param>
 public static JsonResult SimpleCommandResponse(this IApiResponseHelper apiResponseHelper, ValidationError validationError)
 {
     return(apiResponseHelper.SimpleCommandResponse(new ValidationError[] { validationError }));
 }