Exemplo n.º 1
0
 public ActionResult ChangeStatus(PackagePassModel package)
 {
     _proxy.ChangeStatus(package.Barcode);
     return(RedirectToAction("DeliveredPackages", new LoginPassModel()
     {
         Username = package.Username
     }));
 }
Exemplo n.º 2
0
        public ActionResult TakePackage(PackagePassModel packageToTake)
        {
            var result = _proxy.TakePackage(packageToTake.Barcode, packageToTake.CourierID);

            if (result == 1)
            {
                return(RedirectToAction("Deliveries"));
            }
            else if (result == 0)
            {
                var packages = _proxy.GetAllPackages().Select(x => new Models.PackageModel {
                    FromAddress = x.FromAddress, ToAddress = x.ToAddress, Height = x.Height, Weight = x.Weight, Width = x.Width, Price = _proxy.GetDeliveryByPackageBarcode(x.barcode).Price + "", Distance = _proxy.GetDeliveryByPackageBarcode(x.barcode).Distance + "", Barcode = x.barcode, SenderID = x.SenderID, CourierID = (x.CourierID == null) ? 0 : (int)x.CourierID
                }).ToList();
                ModelState.AddModelError(string.Empty, "The package you have selected was already taken by the moment.");
                return(View("Deliveries", packages));
            }
            else
            {
                return(RedirectToAction("Deliveries"));
            }
        }