示例#1
0
        public IActionResult Open([FromRoute(Name = "id")] string id)
        {
            try
            {
                RouletteDto RouletteDto = _rouletteService.Get(id);
                if (RouletteDto == null)
                {
                    return(NotFound());
                }
                if (RouletteDto.Active)
                {
                    return(BadRequest(new
                    {
                        error = false,
                        msg = "RC004"
                    }));
                }
                RouletteDto.Active = true;
                _rouletteService.Update(id, RouletteDto);

                return(Ok(RouletteDto.Active));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public IActionResult Open(string id)
        {
            Roulette _roulette = new Roulette()
            {
                Id       = id,
                Open     = "true",
                OpenDate = DateTime.Now.ToString()
            };

            try
            {
                _rouleteService.Update(id, _roulette);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }