public IActionResult Create()
        {
            Roulette _roulette = new Roulette()
            {
                Open = "false"
            };

            try
            {
                var result = _rouleteService.Create(_roulette);
                return(Created($"{this.Request.Scheme}://{this.Request.Host}{this.Request.Path}/{result.Id}", result.Id));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
Ejemplo n.º 2
0
        public ActionResult <string> Create()
        {
            try
            {
                RouletteDto roulette = new RouletteDto()
                {
                    Id         = ObjectId.GenerateNewId().ToString(),
                    Active     = false,
                    OpenedDate = DateTime.Now.Date,
                    ClosedDate = null,
                    Name       = "Roulette"
                };
                roulette = _rouletteService.Create(roulette);

                return(Ok(roulette.Id));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }