Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }