示例#1
0
        public IActionResult AddEvent(string botId, string text)
        {
            _eventsRepository.AddEvent(new Event
            {
                BotId = botId,
                Text  = text
            });

            return(Redirect("/bot?id=" + botId));
        }
示例#2
0
        public ActionResult Create(SportsbookEventCreation evt)
        {
            var stadiums = _stadiumsRepository.GetStadiums();

            if (!stadiums.Any(s => s.Id == evt.StadiumId))
            {
                return(StatusCode(400, $"No stadium exists with ID {evt.StadiumId}."));
            }

            try
            {
                var id = _eventsRepository.AddEvent(new SportsbookEvent(evt));
                return(Ok(id));
            }
            catch (OperationCanceledException)
            {
                return(StatusCode(400, "Too much event in the system, please delete some."));
            }
        }
        public JsonResult AddEvent(string botId, string text)
        {
            if (string.IsNullOrEmpty(botId))
            {
                return(Json(false));
            }
            if (string.IsNullOrEmpty(text))
            {
                return(Json(false));
            }

            var eventDto = _eventsRepository.AddEvent(new Event
            {
                BotId = botId,
                Text  = text
            });

            return(eventDto != null
                                ? Json(eventDto.Transform())
                                : Json(false));
        }
 public IActionResult AddNewEvent(Events eventToAdd)
 {
     _repo.AddEvent(eventToAdd);
     return(Created($"/ api / events /{ eventToAdd.EventId }", eventToAdd));
 }