Exemple #1
0
        public void DeleteWords_AllIsOk()
        {
            //Act
            var result = _service.DeleteWord(1);

            //Assert
            Assert.IsTrue(result);
        }
        public IActionResult Delete(int wordId)
        {
            string ip = HttpContext.Connection.RemoteIpAddress.ToString();

            try
            {
                _dictionaryService.DeleteWord(wordId, ip);
                return(Ok());
            } catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemple #3
0
        public IActionResult Delete(IFormCollection collection)
        {
            string ip     = HttpContext.Connection.RemoteIpAddress.ToString();
            int    wordId = Int32.Parse(collection["word"]);

            try
            {
                _dictionaryService.DeleteWord(wordId, ip);
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", new { ErrorMessage = ex.Message }));
            }

            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public bool DeleteWordById(int id)
 {
     _logger.Info($"[DictionaryController] The dictionary with id {id} was deleted ");
     return(_dictionaryService.DeleteWord(id));
 }