예제 #1
0
        public async Task <SpellCheckDto> SpellCheck(string text)
        {
            var contentString = await SetUpConnectionAndGetResponse(text);

            var dto = new SpellCheckDto
            {
                Input = text
            };

            var spellCheck = JsonConvert.DeserializeObject <SpellCheck>(contentString);

            if (string.IsNullOrWhiteSpace(spellCheck._type))
            {
                var errorResponse = JsonConvert.DeserializeObject <Error>(contentString);
                dto.ErrorResponse.Errors.Add(errorResponse);
            }
            else
            {
                dto.SpellCheck = spellCheck;
                dto.Correct();
            }

            return(dto);
        }
예제 #2
0
 public async Task <IActionResult> SpellCheck([FromForm] SpellCheckDto dto) =>
 View("Index", await _service.SpellCheck(dto.Input));