diff --git a/Mundialito/Controllers/BetsController.cs b/Mundialito/Controllers/BetsController.cs index d3c73ea..12e8947 100644 --- a/Mundialito/Controllers/BetsController.cs +++ b/Mundialito/Controllers/BetsController.cs @@ -69,7 +69,7 @@ public IEnumerable GetUserBets(string username) [HttpPost] [Authorize(Roles = "Active,Admin")] - public async Task> PostBet(NewBetModel bet) + public async Task> PostBet(NewBetModel bet) { var user = await userManager.FindByNameAsync(httpContextAccessor.HttpContext?.User.Identity.Name); if (user == null) @@ -99,12 +99,12 @@ public async Task> PostBet(NewBetModel bet) if (ShouldSendMail()) SendBetMail(newBet, user); logger.LogInformation("Bet os user {} was saved", user.UserName); - return Ok(bet); + return Ok(new BetViewModel(res, dateTimeProvider.UTCNow)); } [HttpPut("{id}")] [Authorize(Roles = "Active,Admin")] - public async Task> UpdateBet(int id, UpdateBetModel bet) + public async Task> UpdateBet(int id, UpdateBetModel bet) { var user = await userManager.FindByNameAsync(httpContextAccessor.HttpContext?.User.Identity.Name); if (user == null) @@ -132,7 +132,7 @@ public async Task> UpdateBet(int id, UpdateBetModel be if (ShouldSendMail()) SendBetMail(betToUpdate, user); logger.LogInformation("Bet {} of {} was updated", id, user.UserName); - return Ok(new NewBetModel(id, bet)); + return Ok(new BetViewModel(betToUpdate, dateTimeProvider.UTCNow)); } [HttpDelete("{id}")]