Exemple #1
0
        public void CleanDatabase()
        {
            var context = new StagioDbContext();

            context.Database.Initialize(false);
            RemoveAll(context);
            context.SaveChanges();
        }
Exemple #2
0
        public void DeleteAll()
        {
            var context = new StagioDbContext();

            context.Database.Initialize(false);
            context.Database.Delete();
            context.Database.CreateIfNotExists();
            context.SaveChanges();
        }
Exemple #3
0
 private void RemoveAll(StagioDbContext context)
 {
     RemoveOfferApplication(context);
     RemoveInternshipOffer(context);
     RemoveStudent(context);
     RemoveStaffMember(context);
     RemoveOfferDetail(context);
     RemoveNotification(context);
 }
Exemple #4
0
        private void RemoveInternshipOffer(StagioDbContext context)
        {
            IEnumerable <InternshipOffer> query = context.InternshipOffers.ToList().AsEnumerable();

            foreach (InternshipOffer q in query)
            {
                context.InternshipOffers.Remove(q);
            }
            context.SaveChanges();
        }
Exemple #5
0
        private void RemoveOfferApplication(StagioDbContext context)
        {
            IEnumerable <InternshipApplication> query = context.InternshipApplications.ToList().AsEnumerable();

            foreach (InternshipApplication q in query)
            {
                context.InternshipApplications.Remove(q);
            }
            context.SaveChanges();
        }
Exemple #6
0
        private void RemoveStaffMember(StagioDbContext context)
        {
            IEnumerable <StaffMember> query = context.StaffMembers.ToList().AsEnumerable();

            foreach (StaffMember q in query)
            {
                context.StaffMembers.Remove(q);
            }
            context.SaveChanges();
        }
Exemple #7
0
        private void RemoveStudent(StagioDbContext context)
        {
            IEnumerable <Student> query = context.Students.ToList().AsEnumerable();

            foreach (Student q in query)
            {
                context.Students.Remove(q);
            }
            context.SaveChanges();
        }
Exemple #8
0
        private void RemoveNotification(StagioDbContext context)
        {
            IEnumerable <Notification> query = context.Notifications.ToList().AsEnumerable();

            foreach (Notification q in query)
            {
                context.Notifications.Remove(q);
            }
            context.SaveChanges();
        }