public async Task <bool> Delete(int id) { try { var bet = await _betRepository.GetById(id); var bets = await _betRepository.GetBets(); var usuarios = await _usuarioRepository.ObterUsuarios(); var usuario = usuarios.FirstOrDefault(); await _betRepository.DeleteAsync(bet); usuario.RecalculateValues(bets); await _context.SaveChangesAsync(); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }
public async Task <ActionResult <Client.Models.Bet> > DeleteBet(Guid id) { var bet = await repo.DeleteAsync(id); if (bet == null) { return(NotFound()); } ; return(mapper.Map <Client.Models.Bet>(bet)); }