public async Task <Response> SaveBet(Bet bet) { Response response = new Response(); try { Roulette roullete = await rouletteRepository.GetById(bet.Roulette.Id); if (roullete != null) { bet.Roulette = roullete; } Player player = await playerRepository.GetById(bet.Player.Id); if (player != null) { bet.Player = player; } await betRepository.Add(bet); response.Code = Enumerators.State.Ok.GetDescription(); } catch (Exception) { //TODO Save in log response.Code = Enumerators.State.Error.GetDescription(); response.Message = "Error to save the bet."; } return(response); }
public async Task <ResponseEntity <Roulette> > GetRouletteById(long id) { ResponseEntity <Roulette> response = new ResponseEntity <Roulette>(); try { response.Entity = await rouletteRepository.GetById(id); response.Code = Enumerators.State.Ok.GetDescription(); } catch (Exception) { //TODO Save in log response.Code = Enumerators.State.Error.GetDescription(); response.Message = "Error getting roulette by id."; } return(response); }