Exemple #1
0
 public ActionResult UpdateShipment(UpdateShipmentViewModel ship)
 {
     using (myModelContainer context = new myModelContainer())
     {
         var shipment = context.Shipments.Single(e => e.ShipId == ship.ShipId);
         shipment.ShipId       = ship.ShipId;
         shipment.Weight       = ship.Weight;
         shipment.Origin       = ship.Origin;
         shipment.Destination  = ship.Destination;
         shipment.ShippingType = ship.ShippingType;
         shipment.ShippingDate = ship.ShippingDate;
         shipment.ArrivalDate  = ship.ArrivalDate;
         shipment.Status       = ship.Status;
         context.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
Exemple #2
0
        public ActionResult UpdateShipment(int id)
        {
            var shipment = new Shipment();
            UpdateShipmentViewModel usvm = new UpdateShipmentViewModel();

            using (myModelContainer context = new myModelContainer())
            {
                shipment          = context.Shipments.Where(b => b.ShipId == id).FirstOrDefault();
                usvm.ShipId       = shipment.ShipId;
                usvm.Weight       = shipment.Weight;
                usvm.Origin       = shipment.Origin;
                usvm.Destination  = shipment.Destination;
                usvm.ShippingType = shipment.ShippingType;
                usvm.ShippingDate = shipment.ShippingDate;
                usvm.ArrivalDate  = shipment.ArrivalDate;
                usvm.Status       = shipment.Status;
            }
            return(View(usvm));
        }