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()); }
public IActionResult Learned(WordRequest.Learned model) { return(Ok(_wordService.SetWordLearned(model))); }