public async Task <IActionResult> CreateHunt(HuntDto huntDto) { _logger.LogInformation($"Creating new hunt: {huntDto.Hunt}"); await _context.Hunts.AddAsync(new Hunts { Hunt = huntDto.Hunt }); await _context.SaveChangesAsync(); return(Created(nameof(HuntController), null)); }
public async Task <IActionResult> CreateClue(Guid?id, [FromBody] ClueDto clueDto) { _logger.LogInformation($"Creating clue for hunt: {id}"); if (id == null || id == Guid.Empty) { return(NotFound()); } if (!await _context.Hunts.AnyAsync(a => a.HuntId == id)) { return(NotFound()); } await _context.Clues.AddAsync(new Clues { Clue = clueDto.Clue, CreatedBy = clueDto.CreatedBy, FkHuntId = id, Image = clueDto.Image ?? string.Empty }); await _context.SaveChangesAsync(); return(Created(nameof(ClueController), null)); }