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

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

            userWord.IsLearned = model.IsLearned;

            if (model.IsLearned)
            {
                userWord.LearnedDate = DateTime.Now;
            }
            else
            {
                userWord.UpdateDate = DateTime.Now;
            }
            _dbContext.SaveChanges();

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