public void CleanDatabase() { var context = new StagioDbContext(); context.Database.Initialize(false); RemoveAll(context); context.SaveChanges(); }
public void DeleteAll() { var context = new StagioDbContext(); context.Database.Initialize(false); context.Database.Delete(); context.Database.CreateIfNotExists(); context.SaveChanges(); }
private void RemoveAll(StagioDbContext context) { RemoveOfferApplication(context); RemoveInternshipOffer(context); RemoveStudent(context); RemoveStaffMember(context); RemoveOfferDetail(context); RemoveNotification(context); }
private void RemoveInternshipOffer(StagioDbContext context) { IEnumerable <InternshipOffer> query = context.InternshipOffers.ToList().AsEnumerable(); foreach (InternshipOffer q in query) { context.InternshipOffers.Remove(q); } context.SaveChanges(); }
private void RemoveOfferApplication(StagioDbContext context) { IEnumerable <InternshipApplication> query = context.InternshipApplications.ToList().AsEnumerable(); foreach (InternshipApplication q in query) { context.InternshipApplications.Remove(q); } context.SaveChanges(); }
private void RemoveStaffMember(StagioDbContext context) { IEnumerable <StaffMember> query = context.StaffMembers.ToList().AsEnumerable(); foreach (StaffMember q in query) { context.StaffMembers.Remove(q); } context.SaveChanges(); }
private void RemoveStudent(StagioDbContext context) { IEnumerable <Student> query = context.Students.ToList().AsEnumerable(); foreach (Student q in query) { context.Students.Remove(q); } context.SaveChanges(); }
private void RemoveNotification(StagioDbContext context) { IEnumerable <Notification> query = context.Notifications.ToList().AsEnumerable(); foreach (Notification q in query) { context.Notifications.Remove(q); } context.SaveChanges(); }