File tree 1 file changed +29
-2
lines changed
1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
- using System ;
1
+ using Microsoft . Extensions . Configuration ;
2
+ using System ;
3
+ using System . IO ;
4
+ using AdventureData . DAL ;
2
5
3
6
namespace AdventureData
4
7
{
5
8
class Program
6
9
{
10
+ private static IConfiguration _iconfiguration ;
7
11
static void Main ( string [ ] args )
8
12
{
9
- Console . WriteLine ( "Hello World!" ) ;
13
+ GetAppSettingsFile ( ) ;
14
+ ShowAdventureDepartments ( ) ;
15
+ Console . WriteLine ( "Press any key to stop." ) ;
16
+ Console . ReadKey ( ) ;
17
+ }
18
+
19
+ static void GetAppSettingsFile ( )
20
+ {
21
+ var builder = new ConfigurationBuilder ( )
22
+ . SetBasePath ( Directory . GetCurrentDirectory ( ) )
23
+ . AddJsonFile ( "appsettings.json" , optional : false , reloadOnChange : true ) ;
24
+ _iconfiguration = builder . Build ( ) ;
25
+ }
26
+ static void ShowAdventureDepartments ( )
27
+ {
28
+ var deptDAL = new DepartmentDAL ( _iconfiguration ) ;
29
+ var lstDepartment = deptDAL . GetAllDepartments ( ) ;
30
+ lstDepartment . ForEach ( item =>
31
+ {
32
+ Console . WriteLine ( $ "DeptID: { item . DepartmentID } " +
33
+ $ " Name: { item . Name } " +
34
+ $ " Grp Name: { item . GroupName } " +
35
+ $ " Date: { item . ModifiedDate . ToShortDateString ( ) } ") ;
36
+ } ) ;
10
37
}
11
38
}
12
39
}
You can’t perform that action at this time.
0 commit comments