예제 #1
0
        public async Task <int> UpdateWordLevel(WordLevelInfoDto wordLevelInfoDto)
        {
            var words = await _unitOfWork.Repository <Word>().GetFilteredAsync(w => w.Id == wordLevelInfoDto.WordId);

            var word = words.FirstOrDefault();

            if (word.IsNull())
            {
                throw new NullReferenceException();
            }

            word.Level = wordLevelInfoDto.Level;
            return(_unitOfWork.SaveChanges());
        }
예제 #2
0
        public async Task <IActionResult> UpdateWordLevel([FromBody] WordLevelInfoDto wordInfoDto)
        {
            try
            {
                await _wordService.UpdateWordLevel(wordInfoDto);

                return(Ok());
            }
            catch (Exception e)
            {
                Log(e.Message);
                return(BadRequest(e));
            }
        }