public ActionResult OpenRoulette(int id) { try { DataRoulette data = new DataRoulette(); DTO.Roulette roulette = data.getRouletteById(id); if (roulette == null) { return(Ok("La ruleta no existe")); } else if (roulette.isOpen) { return(Ok("La ruleta ya está abierta")); } else { roulette.isOpen = true; data.updateRouletteState(roulette); return(Ok("La ruleta " + id + " se ha abierto")); } } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public ActionResult <List <Bet> > closeRoulette(int id) { try { DataBet data = new DataBet(); DataRoulette dataRoulett = new DataRoulette(); data.closeBet(id); Roulette roulette = new Roulette(); roulette = dataRoulett.getRouletteById(id); roulette.isOpen = false; dataRoulett.updateRouletteState(roulette); List <Bet> returnList = (List <Bet>)data.getBets(); return(returnList); } catch (Exception e) { return((List <Bet>)null); } }