public IActionResult Add(string newWordValue) { string ip = HttpContext.Connection.RemoteIpAddress.ToString(); try { _dictionaryService.AddWord(newWordValue, ip); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult AddWord(IFormCollection collection) { string ip = HttpContext.Connection.RemoteIpAddress.ToString(); string wordToAdd = collection["word"]; try { _dictionaryService.AddWord(wordToAdd, ip); } catch (Exception ex) { return(RedirectToAction("Index", new { ErrorMessage = ex.Message })); } return(RedirectToAction("Index")); }
public WordDictionary AddWordsInDictionary(string original, string translate) { _logger.Info($"[DictionaryController] The dictionary with original: {original} and translate: {translate} was added "); return(_dictionaryService.AddWord(original, translate)); }