public async Task <ActionResult <Roulette> > Open(Guid rouletteId)
        {
            try
            {
                bool     open            = false;
                Roulette currentRoulette = repository.GetById(rouletteId: rouletteId);
                currentRoulette.Status = "Abierta";
                await Task.Run(() =>
                {
                    open = !repository.OpenRoulette(roulette: currentRoulette);
                });

                if (open)
                {
                    return(Ok(currentRoulette));
                }
                else
                {
                    throw new Exception("No se pudo abrir la ruleta.");
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
 public async Task <ActionResult <Roulette> > OpenRoulette(int idRoulette)
 {
     try
     {
         return(Ok(await _rouletterepository.OpenRoulette(idRoulette)));
     }
     catch (Exception ex)
     {
         return(NotFound(new { error = ex.Message, code = "Error al abrir ruleta" }));
     }
 }
Beispiel #3
0
 public IActionResult Open(int id)
 {
     try
     {
         var vsMessage = _rouletteRepository.OpenRoulette(id);
         return(Ok(vsMessage));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
 public async Task <ActionResult> Open(string rouletteId)
 {
     return(Ok(await _repository.OpenRoulette(rouletteId)));
 }