static void Main(string[] args) { //Console.ReadLine(); Task.Factory.StartNew(() => { InitializeData(); }); UserServer userServer = new UserServer(); DataServer dataServer = new DataServer(); userServer.OpenServer(); dataServer.OpenServer(); Log.Info("Servers have been started"); Console.WriteLine("Servers are up and running...\nPress enter to exit"); //using (var context = new DataContext()) //{ // var subs = new Substation() { Name = "dostanice" }; // context.Substations.Add(subs); // context.Users.Add(new User("admin", "admin") { isAdmin = true, FirstName = "Danil", LastName = "Ishutin" }); // context.SaveChanges(); //} Console.ReadLine(); userServer.CloseServer(); dataServer.CloseServer(); Log.Info("Servers have been shut down"); }
private void CheckAndFillData() { IUserServerExtension userServer = new UserServer(); if (userServer.CheckExisting()) { userServer.Add(new User { Name = "Admin", Username = "******", LastName = "Admin", Password = "******" }); userServer.Add(new User { Name = "Stefan", Username = "******", LastName = "Ruvceski", Password = "******" }); userServer.Add(new User { Name = "Teodora", Username = "******", LastName = "Ruvceski", Password = "******" }); } ITelephoneServerExtension telephoneServer = new TelephoneServer(); if (telephoneServer.CheckExisting()) { telephoneServer.AddTelephone(new ShopTelephone() { Name = "IphoneX", Price = 800, Year = 2017, ShopName = "MobilniSvet", Diagonal = 5, Description = "", UserName = "******" }); telephoneServer.AddTelephone(new ShopTelephone() { Name = "SamsungS9", Price = 900, Year = 2018, ShopName = "MobilniSvet", Diagonal = 6, Description = "", UserName = "******" }); telephoneServer.AddTelephone(new ShopTelephone() { Name = "GooglePixel2", Price = 700, Year = 2017, ShopName = "MobShop", Diagonal = 5, UserName = "******", Description = "" }); } IShopServerExtension shopServer = new ShopServer(); if (shopServer.CheckExisting()) { shopServer.AddShop(new Shop() { Name = "MobilniSvet", Address = "Bulevar Cara Lazara 22", PhoneNumber = "06586912534" }); shopServer.AddShop(new Shop() { Name = "MobShop", Address = "Lasla Gala 17", PhoneNumber = "0637502913" }); shopServer.AddShop(new Shop() { Name = "ProdajaTelefona", Address = "Modene 7", PhoneNumber = "0642968504" }); } }