static void Main(string[] args) { var context = new AppDbContext(); //UserController.AddUser(context); //VendorController.AddVendor(context); //ProductController.AddProduct(context); //RequestController.AddRequest(context); //RequestLineController.AddRequestLine(context); //UserController.GetUserByPk(context); //VendorController.GetVendorByPk(context); //ProductController.GetProductByPk(context); //RequestController.GetRequestsByPk(context); //RequestLineController.GetRequestLinesByPk(context); // UserController.GetAllUsers(context); VendorController.GetAllVendors(context); ProductController.GetAllProducts(context); RequestController.GetAllRequests(context); RequestLineController.GetAllRequestLines(context); // //UserController.UpdateUser(context); //VendorController.UpdateVendors(context); //ProductController.UpdateProduct(context); //RequestController.UpdateRequests(context); //RequestLineController.UpdateRequestLines(context); // //RequestLineController.DeleteRequestLine(context); //RequestController.DeleteRequest(context); //ProductController.DeleteProduct(context); //VendorController.DeleteVendor(context); //UserController.DeleteUser(context); }
static void Main(string[] args) { //var context = new AppDbContext(); var UserCtrl = new UserController(); var VendorCtrl = new VendorController(); var ReqCtrl = new RequestController(); var ReqLineCtrl = new RequestLineController(); var ProdCtrl = new ProductController(); #region User Tests //UserCtrl.AddUser("admin", "admin1", "Armon", "Porter", "9375130000", "*****@*****.**", true, true); //UserCtrl.AddUser("test", "test", "test", "this", "isgoing", "tobedeleted", false, false); //UserCtrl.DeleteUser(2); //UserCtrl.GetUserByPk(1); //UserCtrl.GetAllUsers(); #endregion #region Vendor tests var microsoft = new Vendor { Code = "MICRO", Name = "Microsoft", City = "Redmond", State = "WA", Address = "12234 Some Street", Zip = "78904" }; var kroger = new Vendor { Code = "KRGR", Name = "Kroger", City = "Cincinnati", State = "OH", Address = "5432 Vine Street", Zip = "45202" }; //VendorCtrl.AddVendor(microsoft); //VendorCtrl.AddVendor(kroger); //microsoft = VendorCtrl.GetVendorByPk(1); //kroger = VendorCtrl.GetVendorByPk(2); //kroger.Email = "*****@*****.**"; //VendorCtrl.UpdateVendor(2, kroger); //foreach (var v in VendorCtrl.GetAllVendors()) { // Console.WriteLine($"{v.Id} / {v.Name} / {v.Code} / {v.Email}" ); //} #endregion #region Product Tests //var prod = new Product { Name = "Dell Laptop", PartNbr = "dlllptp", Price = 1200, Unit = "ea", VendorId = 1}; //var laptop = ProdCtrl.AddProduct(prod); //prod = new Product { VendorId = 1, Name = "IntelliMouse", PartNbr = "IMSE", Price = 20, Unit = "ea" }; //var mouse = ProdCtrl.AddProduct(prod); //foreach (var p in ProdCtrl.GetAllProducts()) { // Console.WriteLine($"{p.Name} | {p.Price}"); //} #endregion #region Request Tests var request1 = new Request { Description = "Order 1", UserId = 1, Justification = "This is a test" }; //ReqCtrl.AddRequest(request1); request1 = ReqCtrl.GetRequestById(1); //request1.Justification = "Updated Justification"; //ReqCtrl.UpdateRequest(1, request1); //ReqCtrl.MarkReviewed(1); //ReqCtrl.MarkApproved(1); //ReqCtrl.MarkRejected(1, request1); //ReqCtrl.MarkReviewed(1, request1); //foreach (var r in ReqCtrl.GetAllRequests()) { // Console.WriteLine($"{r.Description} / {r.Justification} / {r.Status} / {r.UserId} / {r.RejectionReason} / {r.Total}"); //} #endregion #region RequestLine Tests //var reqL= ReqLineCtrl.GetReqLineById(2); //reqL.Qty = 4; //ReqLineCtrl.UpdateRequestLine(2, reqL); //var rL2 = ReqLineCtrl.AddRequestLine(reqL); //ReqLineCtrl.UpdateTotal(reqL); //ReqLineCtrl.DeleteRequestLine(2); var reqL = new RequestLine { Qty = 2, ProductId = 3, RequestId = 1, Id = 0 }; foreach (var r in ReqCtrl.GetAllRequests()) { Console.WriteLine($"{r.Description} / {r.Justification} / {r.Status} / {r.UserId} / {r.RejectionReason} / {r.Total}"); } //ReqLineCtrl.AddRequestLine(reqL); //ReqLineCtrl.DeleteRequestLine(4); foreach (var r in ReqCtrl.GetAllRequests()) { Console.WriteLine($"{r.Description} / {r.Justification} / {r.Status} / {r.UserId} / {r.RejectionReason} / {r.Total}"); } //ReqLineCtrl.GetAllReqLines(); #endregion }