public IActionResult EditAthleteEnrollsChallenge([FromBody] AthleteEnrollsChallenge challengeEnrollment) { if (ModelState.IsValid) { _dataAccessProvider.UpdateChallengeEnrollmentRecord(challengeEnrollment); return(Ok()); } return(BadRequest()); }
public IActionResult CreateChallengeEnrollment([FromBody] AthleteEnrollsChallenge challengeEnrollment, string token) { if (ModelState.IsValid) { _dataAccessProvider.AddChallengeEnrollmentRecord(challengeEnrollment, token); return(Ok()); } return(BadRequest()); }
/* * Description:Updates an enrollment in AthleteEnrollsChallenge table * Params:Object Race * Output:None */ public void UpdateChallengeEnrollmentRecord(AthleteEnrollsChallenge challengeEnrollment) { _context.athleteenrollschallenges.Update(challengeEnrollment); _context.SaveChanges(); }
/* * Description:Adds a race to AthleteEnrollsChallenge table * Params:Object Race * Output:None */ public void AddChallengeEnrollmentRecord(AthleteEnrollsChallenge challengeEnrollment, string token) { challengeEnrollment.id_athlete = _context.onlineusers.Where(ou => ou.token == token).Select(a => a.id_athlete_fk).SingleOrDefault(); _context.athleteenrollschallenges.Add(challengeEnrollment); _context.SaveChanges(); }