public ActionResult <JudgeParticipantModel> AddParticipant(JudgeParticipantModel judgeParticipant) { if (judgeParticipants.CreateNewJudgeParticipant(contests.Get1Contest(judgeParticipant.contestId), judges.Get1Judge(judgeParticipant.judgeId))) { return(Ok()); } return(BadRequest()); }
public ActionResult <JudgeParticipantModel> Get1JudgeParticipant(int id) { JudgeParticipantModel judgeParticipant = judgeParticipants.Get1JudgeParticipant(id); if (judgeParticipant != null) { return(judgeParticipant); } return(NotFound()); }
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); }