public async Task <IActionResult> Submit([FromBody] SubmitRequest request) { try { var set = await setService.Update(request.SetID, request.Matches); dbContext.Entry(set).Reference(s => s.League).Load(); var response = SetDto.Create(set, set.League.GameID); return(CodeResultAndLog(HttpStatusCode.OK, response, $"Set {set.ID} updated.")); } catch (Exception exception) { return(GetExceptionResult(exception, request)); } }
public async Task <IActionResult> Get(int setID) { var set = await dbContext.Sets .Include(s => s.Matches).ThenInclude(m => m.MatchCharacters).AsNoTracking() .Include(s => s.League).AsNoTracking() .FirstOrDefaultAsync(s => s.ID == setID); if (set == null) { return(CodeResultAndLog(HttpStatusCode.NotFound, $"Could not find Set with ID '{setID}'.")); } var dto = SetDto.Create(set, set.League.GameID); return(CodeResult(HttpStatusCode.OK, dto)); }