Ejemplo n.º 1
0
        public async Task <IActionResult> ValidateDocument(string lang)
        {
            _stringResourceHelper.SetLanguage(lang);
            using StreamReader stream = new StreamReader(Request.Body);
            string document = await stream.ReadToEndAsync();

            List <ValidationError> errors = new List <ValidationError>();

            GrouperDocument.FromJson(document, errors);
            return(Ok(errors));
        }
Ejemplo n.º 2
0
        public IActionResult Error()
        {
            if (HttpContext.Request.Query.TryGetValue("lang", out var values))
            {
                if (values.Count > 0)
                {
                    _stringResourceHelper.SetLanguage(values[0]);
                }
            }
            var feature = HttpContext.Features.Get <IExceptionHandlerPathFeature>();

            if (feature?.Error is ChangeRatioException)
            {
                return(Problem(_stringResourceHelper.GetString(ResourceString.ErrorBelowChangeLimit)));
            }
            if (feature?.Error is InvalidGrouperDocumentException)
            {
                return(Problem(_stringResourceHelper.GetString(ResourceString.ErrorGrouperDocumentNotValid)));
            }
            return(Problem());
        }