public async Task <IActionResult> CreateDebate(DebateRequestDto newDebate) { var debate = await _debateService.CreateDebate(newDebate); if (!debate) { return(BadRequest()); } return(Ok(debate)); }
private async Task GenerateDebates() { var users = await _context.Users.ToListAsync(); var debates = new DebateRequestDto[] { new DebateRequestDto() { Topic = $"New guy {users[0].Email}", Description = $"Description {users[0].Email}", CreatedById = users[0].Id }, new DebateRequestDto() { Topic = $"New guy {users[1].Email}", Description = $"Description {users[1].Email}", CreatedById = users[1].Id }, new DebateRequestDto() { Topic = $"New guy {users[2].Email}", Description = $"Description {users[2].Email}", CreatedById = users[2].Id }, new DebateRequestDto() { Topic = $"New guy {users[3].Email}", Description = $"Description {users[3].Email}", CreatedById = users[3].Id }, new DebateRequestDto() { Topic = $"New guy {users[4].Email}", Description = $"Description {users[4].Email}", CreatedById = users[4].Id }, }; foreach (var debate in debates) { await _debateService.CreateDebate(debate); } await _context.SaveChangesAsync(); }