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));
            }
        }
예제 #2
0
        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"));
        }
예제 #3
0
 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));
 }