-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
67 lines (46 loc) · 1.47 KB
/
Program.cs
File metadata and controls
67 lines (46 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using CodingTracker;
using CodingTracker.Model;
using System.Configuration;
Console.Title = "Coding Tracker";
string connection = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
var repository = new CodingSessionRepository(connection);
repository.CreateTable();
repository.SeedDatabase();
string? menuChoice;
do
{
menuChoice = Display.PrintMainMenu();
switch (menuChoice)
{
case "Close Application":
Console.WriteLine("\nGoodbye!");
Thread.Sleep(2000);
Environment.Exit(0);
break;
case "View All Records":
Display.PrintAllRecords("View All Records");
UI.ReturnToMainMenu();
break;
case "Add Record":
RecordsController.AddRecord();
UI.ReturnToMainMenu();
break;
case "Edit Record":
RecordsController.EditRecord();
UI.ReturnToMainMenu();
break;
case "Delete Record":
RecordsController.DeleteRecord();
UI.ReturnToMainMenu();
break;
case "View Report":
repository = new CodingSessionRepository(connection);
var reportData = repository.GetReportData();
Display.PrintReport(reportData);
UI.ReturnToMainMenu();
break;
default:
Console.WriteLine("Invalid choice.");
break;
}
} while (menuChoice != "Close Application");