public async Task<MatchDto> GetMatchAsync(int id)
 {
     var match = await _context.Matches.FirstOrDefaultAsync(m => m.Id == id);
     if (match == null)
     {
         throw new NotFoundException();
     }
     var matchDto = new MatchDto
     {
         Id = match.Id,
         Boxer1 = match.Boxer1,
         Boxer2 = match.Boxer2,
         DateOfMatch = match.DateOfMatch,
         Description = match.Description,
         Place = match.Place,
         Winner = match.Winner,
         Status = (MatchStatusesEnum)match.StatusId
     };
     return matchDto;
 }
 public async Task<MatchDto> AddMatchAsync(MatchDto match)
 {
     var addedMatch = _context.Matches.Add(new Match
     {
         Boxer1 = match.Boxer1,
         Boxer2 = match.Boxer2,
         DateOfMatch = match.DateOfMatch,
         Description = match.Description,
         Place = match.Place,
         StatusId = (int)MatchStatusesEnum.Active
     });
     await _context.SaveChangesAsync();
     return new MatchDto
     {
         Id = addedMatch.Id,
         Boxer1 = addedMatch.Boxer1,
         Boxer2 = addedMatch.Boxer2,
         DateOfMatch = addedMatch.DateOfMatch,
         Description = addedMatch.Description,
         Place = addedMatch.Place,
         Status = (MatchStatusesEnum) addedMatch.StatusId
     };
 }
 public async Task<HttpResponseMessage> Create([FromBody] MatchModel match)
 {
     var matchDto = new MatchDto
     {
         Boxer1 = match.Boxer1,
         Boxer2 = match.Boxer2,
         DateOfMatch = match.DateOfMatch,
         Description = match.Description,
         Place = match.Place
     };
     await _matchesService.AddMatchAsync(matchDto);
     return Request.CreateResponse(HttpStatusCode.Created);
 }
 public async Task UpdateMatchAsync(MatchDto matchDto)
 {
     var match = await _context.Matches.FirstOrDefaultAsync(m => m.Id == matchDto.Id);
     match.StatusId = (int) matchDto.Status;
     match.Boxer2 = matchDto.Boxer2;
     match.Boxer1 = matchDto.Boxer1;
     match.Place = matchDto.Place;
     match.DateOfMatch = matchDto.DateOfMatch;
     match.Description = matchDto.Description;
     match.Winner = matchDto.Winner;
     await _context.SaveChangesAsync();
 }