Exemplo n.º 1
0
        public IActionResult Create(CreateContestModel model)
        {
            if (!this.User.IsAuthenticated)
            {
                return(this.RedirectToLogin());
            }

            if (!this.IsValidModel(model))
            {
                this.ShowError(InvalidContestTitle);
                return(this.View());
            }

            this.contestService.Create(model.ContestName, this.User.Name);

            return(Redirect("/contests/all"));
        }
        public async Task <ActionResult> Create([FromBody] CreateContestModel contestModel, User user)
        {
            var contest = await contestAdminManager.Create(contestModel, user.Id);

            return(Json(contest));
        }
Exemplo n.º 3
0
 public IActionResult Create([FromBody] CreateContestModel model)
 {
     return(Ok(new { ContestId = _contestService.Create(model.Name, model.TournamentId, model.CompetitorIds) }));
 }