Beispiel #1
0
 public ActionResult <JudgeParticipantModel> AddParticipant(JudgeParticipantModel judgeParticipant)
 {
     if (judgeParticipants.CreateNewJudgeParticipant(contests.Get1Contest(judgeParticipant.contestId), judges.Get1Judge(judgeParticipant.judgeId)))
     {
         return(Ok());
     }
     return(BadRequest());
 }
Beispiel #2
0
        public ActionResult <JudgeParticipantModel> Get1JudgeParticipant(int id)
        {
            JudgeParticipantModel judgeParticipant = judgeParticipants.Get1JudgeParticipant(id);

            if (judgeParticipant != null)
            {
                return(judgeParticipant);
            }
            return(NotFound());
        }
Beispiel #3
0
        public bool CreateNewJudgeParticipant(ContestModel contest, JudgeModel judge)
        {
            JudgeParticipantModel entry = new JudgeParticipantModel();

            entry.Contest = contest; //Foreign key
            entry.Judge   = judge;   //Foreign key
            db.judgeParticipant.Add(entry);
            db.SaveChanges();
            if (db.judgeParticipant.Contains(entry))
            {
                return(true);
            }
            return(false);
        }