public ActionResult SendPackage(Package pack) { ViewBag.DistributionCenters = new DistributionCenterService().GetDistributionCenterList(); if (Request.Form["SearchBarcode"] != null) { return(View(packageServies.CheckIfBarcodeExist(pack.Barcode, StockType.InStock))); } else if (Request.Form["SendPackageConfirm"] != null) { packageServies.UpdatePackageStatus(WebSecurity.CurrentUserId, pack.Barcode, StockType.InTransit, pack.ReceivingCenterID.Value); } return(View()); }
public void CheckExistTest() { int barcode = packageDao.RegisterPackage(testPack); var result = packageService.CheckIfBarcodeExist(barcode, null); int resultBarcode = result.Barcode; var pack = packageDao.Packages.SingleOrDefault(Package => Package.Barcode == barcode); packageDao.Packages.Remove(pack); packageDao.SaveChanges(); Assert.AreEqual(barcode, resultBarcode); }