public ActionResult Purchase(SalesIndexPuchaseCM form) { if (ModelState.IsValid) { Purchases purchase = new Purchases(); var repo = new PurchaseRepositoryADO(); var vRepo = new VehicleRepositoryADO(); purchase.VehicleId = form.VehicleId; purchase.Phone = form.Phone; purchase.Email = form.Email; purchase.StreetOne = form.StreetOne; purchase.StreetTwo = form.StreetTwo; purchase.City = form.City; purchase.ZipCode = form.Zipcode; purchase.State = form.State; purchase.PurchasePrice = form.PurchasePrice; purchase.PurchaseType = form.PurchaseType; purchase.EmployeeId = form.EmployeeId; repo.CreatePurchase(purchase); return(RedirectToAction("Index")); } else { SalesIndexPuchaseVM VM = new SalesIndexPuchaseVM(); var vehicle = new VehicleRepositoryADO(); VM.Vehicles = vehicle.ReadAllVehicle(); VM.Form = form; return(View(VM)); } }
public void CanAddPurchase() { Purchase purchaseToAdd = new Purchase(); var repo = new PurchaseRepositoryADO(); purchaseToAdd.SellName = "Test"; purchaseToAdd.SellPhone = "999-999-9999"; purchaseToAdd.SellEmail = "*****@*****.**"; purchaseToAdd.SellStreet1 = "1234 test ct."; purchaseToAdd.SellStreet2 = null; purchaseToAdd.City = "test"; purchaseToAdd.State = "st"; purchaseToAdd.ZipCode = 99999; purchaseToAdd.PurchasePrice = 999999; purchaseToAdd.PurchaseTypeID = 4; purchaseToAdd.UserID = "00000000-1111-1111-0000-000000000000"; purchaseToAdd.VehicleID = 2; repo.Insert(purchaseToAdd); Assert.AreEqual(6, purchaseToAdd.PurchaseID); Assert.AreEqual("Test", purchaseToAdd.SellName); Assert.AreEqual("999-999-9999", purchaseToAdd.SellPhone); Assert.AreEqual("*****@*****.**", purchaseToAdd.SellEmail); Assert.AreEqual("1234 test ct.", purchaseToAdd.SellStreet1); Assert.IsNull(purchaseToAdd.SellStreet2); Assert.AreEqual("test", purchaseToAdd.City); Assert.AreEqual("st", purchaseToAdd.State); Assert.AreEqual(99999, purchaseToAdd.ZipCode); Assert.AreEqual(999999, purchaseToAdd.PurchasePrice); Assert.AreEqual(4, purchaseToAdd.PurchaseTypeID); Assert.AreEqual(2, purchaseToAdd.VehicleID); Assert.AreEqual("00000000-1111-1111-0000-000000000000", purchaseToAdd.UserID); }
public void CanLoadPurchase() { var repo = new PurchaseRepositoryADO(); var purchases = repo.GetAll(); Assert.AreEqual(5, purchases.Count); Assert.AreEqual(1, purchases[0].PurchaseID); Assert.AreEqual(34560, purchases[2].PurchasePrice); }
public void CanLoadPurchases() { var repo = new PurchaseRepositoryADO(); var purchases = repo.GetAll(); Assert.AreEqual(3, purchases.Count); Assert.AreEqual(5, purchases[2].VehicleID); Assert.AreEqual(3, purchases[2].CustomerID); Assert.AreEqual("Dealer Finance", purchases[2].PurchaseType); }
public void CanAddPurchase() { Purchase purchaseToAdd = new Purchase(); var repo = new PurchaseRepositoryADO(); purchaseToAdd.PurchaseType = "Cash"; purchaseToAdd.PurchasePrice = 20000M; purchaseToAdd.CustomerID = 2; purchaseToAdd.UserID = "00000000-0000-0000-0000-000000000000"; purchaseToAdd.SpecialID = 1; purchaseToAdd.VehicleID = 4; repo.Insert(purchaseToAdd); Assert.AreEqual(4, purchaseToAdd.PurchaseID); }
public void CanAddReciept() { var repo = new PurchaseRepositoryADO(); var reciept = new SalesReciepts(); reciept.CustomerId = 1; reciept.Date = DateTime.Now; reciept.EmployeeId = 1; reciept.PaymentMethodId = 1; reciept.Total = 30000; reciept.VehicleId = 1; repo.SavePurchase(reciept); Assert.AreEqual(1, 1); }
public void CanAddCustomer() { var repo = new PurchaseRepositoryADO(); var cust = new Customer(); cust.City = "New City"; cust.Email = "*****@*****.**"; cust.FirstName = "mr"; cust.LastName = "customer"; cust.Phone = "1111111111"; cust.Street1 = "street"; cust.Street2 = "apartment 1"; cust.Zip = "40205"; repo.SaveCustomerInfo(cust); Assert.AreEqual(1, 1); }