public void MultipleAssignmentInput()
        {
            bool valid = true;

            do
            {
                AssignmentDataCapture assignmentCapture = new AssignmentDataCapture();
                assignments           assignment        = assignmentCapture.Capture();

                using (privateschoolEntities dbContex = new privateschoolEntities())
                {
                    dbContex.assignments.Add(assignment);
                    foreach (var student in dbContex.students)
                    {
                        if (student.courses.Contains(assignment.courses))
                        {
                            student.assignments.Add(assignment);
                        }
                    }

                    dbContex.SaveChanges();
                }
                Console.WriteLine();
                Music.EndBeep();
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("ASSIGNMENT HAS BEEN CREATED");
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Do you want to create another assignment?  Press 'NO' or 'no' to exit.");
                Console.WriteLine("Type anything else to continue creating another Assignment");
                Console.ForegroundColor = ConsoleColor.White;
                string value = Console.ReadLine();

                if (value == "NO" || value == "No" || value == "no")
                {
                    valid = false;
                }
            } while (valid);
        }
Beispiel #2
0
 public InputAssignment()
 {
     Assignment = new assignments();
 }
Beispiel #3
0
 public void Show(assignments assignment)
 {
     Console.WriteLine($"{assignment.title,-20} | {assignment.description,-30} | {assignment.subdatetime.ToString("dd/MM/yyyy"),-20} | {assignment.oralmark,-10} | {assignment.totalmark,-12} |");
 }