Esempio n. 1
0
        public ResponseResult AddCustomSentence(WordRequest.CustomSentence model)
        {
            var userWord = GetUserWord(model.UserWordId);

            if (userWord.IsNullOrDefault())
            {
                return(new ResponseResult()
                {
                    Error = true, ErrorMessage = "The word not found"
                });
            }

            _dbContext.Sentences.Add(new Sentence
            {
                CreatedDate = DateTime.Now,
                IsPrivate   = model.IsPrivate,
                UserId      = userWord.UserId,
                Text        = model.Sentence,
                WordId      = userWord.WordId,
            });

            _dbContext.SaveChanges();

            return(new ResponseResult());
        }
Esempio n. 2
0
 public IActionResult CustomSentence(WordRequest.CustomSentence model)
 {
     return(Ok(_wordService.AddCustomSentence(model)));
 }