public void insertAthleteOnCoach(int athleteId, int coachId) { coachByAthelete coachByAthl = new coachByAthelete(); coachByAthl.coachId = coachId; coachByAthl.atheleteId = athleteId; coachByAthl.available = true; context.coachByAthelete.Add(coachByAthl); context.SaveChanges(); }
public string PostByAtheleteNameOnCoach(int coachId, string athleteName) { athelete athleteFinded = context.athelete.Include("user").FirstOrDefault(a => a.user.username == athleteName); if (athleteFinded != null) { coachByAthelete coachByAthl = new coachByAthelete(); coachByAthl.coachId = coachId; coachByAthl.atheleteId = athleteFinded.id; context.coachByAthelete.Add(coachByAthl); context.SaveChanges(); return("Atleta encontrado"); } else { return("Atleta no encontrado"); } }