public void CopyToModule(Module aModule, ApplicationDbContext aContext) { //Copy the receiver to the given module and context UnitBuilder unitBuilder = new UnitBuilder(aContext); unitBuilder.Title = this.Title; unitBuilder.Module = aModule; unitBuilder.Semester = this.Semester; unitBuilder.BeginDate = this.BeginDate; unitBuilder.EndDate = this.BeginDate; unitBuilder.ExamType = this.ExamType; unitBuilder.Skills = this.Skills().ToList(); unitBuilder.DurationOfExam = this.DurationOfExam; unitBuilder.Save(); }
public bool deleteFromContext(ApplicationDbContext aContext) { //Delete the receiver from the context UnitSearch search = new UnitSearch(aContext); search.LecturerId = this.Id; Lecturer dummyLecturer = aContext.DummyNoneLecturer(); foreach (Unit eachUnit in search.Search()) { UnitBuilder unitBuilder = new UnitBuilder(aContext, eachUnit); unitBuilder.Lecturer = dummyLecturer; unitBuilder.Save(false); } aContext.Lecturers.Remove(this); return(true); }