public async Task<JsonResult> Index(SpellcheckRequest model) { var spellService = new GoogleSpell(); IEnumerable<string> result = null; if(string.Equals(model.method, "getSuggestions", StringComparison.InvariantCultureIgnoreCase)) { result = (await spellService.SuggestionsAsync([email protected]().Single(), [email protected](1).First().Single())); } else //assume checkWords { result = (await spellService.SpellcheckAsync([email protected]().Single(), [email protected](1).First())); } string error = null; return Json( new { result, id = model.id, error } ); }
public async Task <JsonResult> Index(SpellcheckRequest model) { var spellService = new GoogleSpell(); IEnumerable <string> result = null; if (string.Equals(model.method, "getSuggestions", StringComparison.InvariantCultureIgnoreCase)) { result = (await spellService.SuggestionsAsync([email protected]().Single(), [email protected](1).First().Single())); } else //assume checkWords { result = (await spellService.SpellcheckAsync([email protected]().Single(), [email protected](1).First())); } string error = null; return(Json(new { result, id = model.id, error })); }