Skip to content

Commit

Permalink
Merge pull request #144 from ezraroi/143-bug-after-adding-a-bet-on-a-…
Browse files Browse the repository at this point in the history
…game-from-the-game-view

fixed
  • Loading branch information
ezraroi authored Oct 1, 2024
2 parents 1e413d2 + 88238f9 commit af805bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Mundialito/Controllers/BetsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public IEnumerable<BetViewModel> GetUserBets(string username)

[HttpPost]
[Authorize(Roles = "Active,Admin")]
public async Task<ActionResult<NewBetModel>> PostBet(NewBetModel bet)
public async Task<ActionResult<BetViewModel>> PostBet(NewBetModel bet)
{
var user = await userManager.FindByNameAsync(httpContextAccessor.HttpContext?.User.Identity.Name);
if (user == null)
Expand Down Expand Up @@ -99,12 +99,12 @@ public async Task<ActionResult<NewBetModel>> 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<ActionResult<NewBetModel>> UpdateBet(int id, UpdateBetModel bet)
public async Task<ActionResult<BetViewModel>> UpdateBet(int id, UpdateBetModel bet)
{
var user = await userManager.FindByNameAsync(httpContextAccessor.HttpContext?.User.Identity.Name);
if (user == null)
Expand Down Expand Up @@ -132,7 +132,7 @@ public async Task<ActionResult<NewBetModel>> 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}")]
Expand Down

0 comments on commit af805bd

Please sign in to comment.