コード例 #1
0
        public IActionResult Add([FromForm] ContestViewModel contest)
        {
            if (ModelState.IsValid)
            {
                var contestModel = new Contest
                {
                    ContestId     = Guid.NewGuid(),
                    Content       = contest.Content,
                    StartDate     = contest.StartDate,
                    EndDate       = contest.EndDate,
                    StatusContest = ContestStatus.UnderConstruction.ToString(),
                    Title         = contest.Title,
                };
                _contestRepository.Create(contestModel);
                _contestRepository.Save();

                //send mail to all the registered user with the contest
                //InformUsersNewContest(contest.Title);

                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }
コード例 #2
0
 public int Create(string name, int tournamentId, List <int> competitorIds)
 {
     return(_contestRepo.Create(name, tournamentId, competitorIds));
 }