public static void AddStudent()
        {
            using (var db = new AppDbContext())
            {
                Console.WriteLine("Enter student name:\n");
                string nameInput = Console.ReadLine();

                Console.WriteLine("Enter birthday in format 'Jan 1, 2009'\n");
                string   bdayInput    = Console.ReadLine();
                DateTime bdayDateTime = DateTime.Parse(bdayInput);

                Console.WriteLine("Enter enrollment date in format 'Jan 1, 2009'\n");
                string   enrollInput    = Console.ReadLine();
                DateTime enrollDateTime = DateTime.Parse(enrollInput);

                Console.WriteLine("Enter graduation date in format 'Jan 1, 2009'\n");
                string   gradInput    = Console.ReadLine();
                DateTime gradDateTime = DateTime.Parse(gradInput);

                /*
                 * Console.WriteLine("Enter the students au-id\n");
                 * int auidInput = int.Parse(Console.ReadLine());
                 */
                var auid = new AU();

                db.AUIDs.Add(auid);
                db.SaveChanges();

                var student = new Student()
                {
                    Name     = nameInput,
                    Birthday = bdayDateTime,
                    AUId     = auid.AUId,
                    //AUId = auidInput,
                    EnrolledDate   = enrollDateTime,
                    GraduationDate = gradDateTime,
                    Enrollments    = new List <Enrollments>(),
                    StudentGroups  = new List <StudentGroups>()
                };


                db.Students.Add(student);
                db.SaveChanges();

                Console.WriteLine($"New student {student.Name} has been given AU-Id {student.AUId}");
            }
        }
 public void SetData(AU finalsession)
 {
     AU = finalsession;
 }
 public AUDetailPage(AU au)
 {
     InitializeComponent();
     BindingContext = ViewModel = new AUDetailsViewModel();
     ViewModel.SetData(au);
 }
Example #4
0
 public KinectData()
 {
     mAU = new AU();
 }