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()); }
public async Task <IActionResult> UpdateWordLevel([FromBody] WordLevelInfoDto wordInfoDto) { try { await _wordService.UpdateWordLevel(wordInfoDto); return(Ok()); } catch (Exception e) { Log(e.Message); return(BadRequest(e)); } }