private void InitializeCalendar() { var practice = _context.PracticeCalendarItems.ToListAsync(); _context.RemoveRange(practice.Result); var calendar = _context.CalendarItems.ToListAsync(); _context.RemoveRange(calendar.Result); var athletes = _context.RegisteredAthlete.ToListAsync(); _context.SaveChanges(); }
public async Task <Registrant> AddRegisteredAthlete(int registrantId, int athleteId) { var athlete = new RegisteredAthlete() { AthletesId = athleteId, RegistrantId = registrantId }; var registrant = await _context.Registrant .Where(r => r.Id == registrantId).FirstOrDefaultAsync(); registrant?.RegisteredAthlete.Add(athlete); _context.SaveChanges(); return(registrant); }
private void InitializeSports() { var teams = _context.Teams.ToListAsync(); _context.RemoveRange(teams.Result); var categogies = _context.SportTypes.ToListAsync(); _context.RemoveRange(categogies.Result); var locations = _context.Programs.ToListAsync(); _context.RemoveRange(locations.Result); var sports = _context.Sports.ToListAsync(); _context.RemoveRange(sports.Result); var places = _context.Locations.ToListAsync(); _context.RemoveRange(places.Result); var times = _context.CalendarTimes.ToListAsync(); _context.RemoveRange(times.Result); _context.SaveChanges(); }