public TodoController(Assignment2Context context) { _context = context; if (_context.ModelClass.Count() == 0) { // Create a new TodoItem if collection is empty, // which means you can't delete all TodoItems. _context.ModelClass.Add(new ModelClass { Name = "Item1" }); _context.SaveChanges(); } }
public MountainsController(Assignment2Context context) { _context = context; }
public UserService(Assignment2Context context) { _context = context; }
public static void Main(string[] args) { using (var db = new Assignment2Context()) { db.Database.ExecuteSqlCommand("delete from HelpRequests"); db.Database.ExecuteSqlCommand("delete from StudentCourses"); db.Database.ExecuteSqlCommand("delete from HelpRequests"); db.Database.ExecuteSqlCommand("delete from Exercises"); db.Database.ExecuteSqlCommand("delete from Courses"); db.Database.ExecuteSqlCommand("delete from Teachers"); db.Database.ExecuteSqlCommand("delete from Students"); var student = new Student() { Name = "Jokum", AUID = "AU785594" }; db.Add(student); db.SaveChanges(); var student3 = new Student() { Name = "Jordkim", AUID = "AU789456" }; db.Add(student3); db.SaveChanges(); var student2 = new Student() { Name = "DJDudeMan", AUID = "AU223684" }; db.Add(student2); db.SaveChanges(); var course = new Course() { Name = "Avanceret Løgspark" }; db.Add(course); var course2 = new Course() { Name = "Matematik" }; db.Add(course2); db.SaveChanges(); db.Add(new StudentCourse() //Add a student to a course { Active = true, Course = course, Semester = 2, Student = student }); db.Add(new StudentCourse() //Add another student to the same course { Active = true, Course = course, Student = student2 }); db.SaveChanges(); Teacher teacher2 = new Teacher() { name = "Karl Jorgen", AUID = "AU555555", CourseID = course2.CourseID }; Teacher teacher1 = new Teacher() { name = "Dr. John", AUID = "AU000000", CourseID = course.CourseID }; db.SaveChanges(); Exercise E1 = new Exercise() { Number = 0, Lecture = "English", Help_Where = "Auditoriet", Student = student, Teacher = teacher1, Course = course, Open = true }; db.Add(E1); Exercise E2 = new Exercise() { Number = 420, Lecture = "Danks", Help_Where = "PBA", Student = student, Teacher = teacher1, Course = course, Open = true }; db.Add(E2); Exercise E3 = new Exercise() { Number = 545, Lecture = "Danks", Help_Where = "PBA", Student = student2, Teacher = teacher2, Course = course2 }; db.Add(E3); db.SaveChanges(); var A1 = new Assignment() { Course = course, Teacher = teacher1 }; db.Add(A1); db.SaveChanges(); var A1Students = new HelpRequest() { Open = false, Assignment = A1, Student = student }; db.Add(A1Students); var A1Students2 = new HelpRequest() { Open = true, Assignment = A1, Student = student2 }; db.Add(A1Students2); db.SaveChanges(); } CreateHostBuilder(args).Build().Run(); }
public GamesController(Assignment2Context context) { _context = context; }
public CineplexesController(Assignment2Context context) { _context = context; }
public HuntingGroundsService(Assignment2Context context, IAssociationService associationService) { _context = context; _associationService = associationService; }
public CustomersController(Assignment2Context context) { _context = context; }
public MembersController(Assignment2Context context) { _context = context; }
public AssociationService(Assignment2Context context) { _context = context; }
public SessionTimesController(Assignment2Context context) { _context = context; }
public HikeLogsController(Assignment2Context context) { _context = context; }
public CompaniesController(Assignment2Context context) { _context = context; }
public MovieComingSoonsController(Assignment2Context context) { _context = context; }