public AdminController() { RepairAnywhereDbContext radb = new RepairAnywhereDbContext(); _AdminService = new AdminService(radb); _CustomerService = new CustomerService(radb); _LoginService = new LoginService(radb); _RepairmanService = new RepairmanService(radb); _ReportService = new ReportService(radb); _RequestService = new RequestService(radb); _ReviewService = new ReviewService(radb); }
public void DeleteFromTable() { RepairAnywhereDbContext radb = new RepairAnywhereDbContext(); //Insert Admin AdminService AS = new AdminService(radb); IEnumerable <Admin> admins = AS.GetAll(); foreach (var item in admins) { Console.WriteLine("\nDeleted " + AS.Delete(item.AdminID)); } }
public void Retieve() { RepairAnywhereDbContext radb = new RepairAnywhereDbContext(); //Insert Admin AdminService Aser = new AdminService(radb); IEnumerable <Admin> admins = Aser.GetAll(); foreach (var item in admins) { Console.WriteLine(item.Name + "\n" + item.PhoneNumber + "\n" + item.Password + "\n\n"); } }
public void InsertInTable() { RepairAnywhereDbContext radb = new RepairAnywhereDbContext(); //Insert Admin AdminService AS = new AdminService(radb); Admin a1 = new Admin(); a1.Name = "admin"; a1.PhoneNumber = 01111111111; a1.Email = "*****@*****.**"; a1.Password = "******"; CustomerService CS = new CustomerService(radb); Customer c1 = new Customer(); c1.Email = "*****@*****.**"; c1.Password = "******"; c1.Name = "mac"; c1.PhoneNumber = "2342"; c1.Address = "Mirpur1"; c1.Status = "Idle"; c1.MemberSince = DateTime.Now; c1.LastLogin = DateTime.Now; RepairmanService RS = new RepairmanService(radb); Repairman r1 = new Repairman(); r1.Name = "mac2"; r1.Email = "*****@*****.**"; r1.PhoneNumber = "7007"; r1.Password = "******"; r1.Address = "Mirpur2"; r1.Status = "Idle"; r1.Rating = 4.0; r1.MemberSince = DateTime.Now; r1.LastLogin = DateTime.Now; LoginService LS = new LoginService(radb); Login l1 = new Login(); l1.Username = "******"; l1.Password = "******"; l1.UserID = 1; l1.UserType = "Admin"; Login l2 = new Login(); l2.Username = "******"; l2.Password = "******"; l2.UserID = 1; l2.UserType = "Customer"; Login l3 = new Login(); l3.Username = "******"; l3.Password = "******"; l3.UserID = 1; l3.UserType = "Repairman"; Console.WriteLine("\n inseted " + AS.Insert(a1) + RS.Insert(r1) + CS.Insert(c1) + LS.Insert(l1) + LS.Insert(l2) + LS.Insert(l3)); }