public ActionResult <bool> OpenRoulette([FromBody] OpenRouletteRequest openRoulette)
        {
            bool rouletteExist = _rouletteService.ExistRoulette(openRoulette.RoulettetoOpen);

            if (!rouletteExist)
            {
                return(NotFound());
            }
            else
            {
                _rouletteService.OpenRoulette(openRoulette);
            }

            return(Ok(true));
        }
        public ActionResult OpenRoulette(int id)
        {
            try
            {
                bool successTransaction = rouletteService.OpenRoulette(id);
                if (!successTransaction && !string.IsNullOrEmpty(rouletteService.ErrorMessage))
                {
                    return(BadRequest(rouletteService.ErrorMessage));
                }

                return(Ok(successTransaction));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Exemple #3
0
        public async Task <IActionResult> OpenRoulette(int rouletteId)
        {
            try
            {
                var result = await _rouletteService.OpenRoulette(rouletteId);

                if (result == ResponseCode.Ok)
                {
                    return(Ok(result));
                }
                return(BadRequest(ResponseMessages[ResponseCode.Rejected]));
            }
            catch (Exception ex)
            {
                return(BadRequest(ResponseMessages[ResponseCode.InternalError]));
            }
        }
Exemple #4
0
        public HttpResponseMessage OpenRoulette(Roulette roulette)
        {
            var response = Request.CreateResponse(HttpStatusCode.NotImplemented);

            var res = RouletteService.OpenRoulette(roulette.Id);

            if (res >= 1)
            {
                response = Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.NotModified);
            }


            return(response);
        }
Exemple #5
0
        public async Task <IActionResult> OpenRulette(int id)
        {
            var roulette = await _rouletteService.OpenRoulette(id);

            return(Ok(ResponseMapper.MapOp(roulette)));
        }