Ejemplo n.º 1
0
        public ActionResult Edit(editShipmentViewModel s)
        {
            using (EntityDataModelContainer context = new EntityDataModelContainer())
            {
                var shipment = context.Shipments.Single(x => x.Id == s.Id);

                shipment.Shipping_date = s.Shipping_date;
                shipment.Destination   = s.Destination;
                shipment.Type          = s.Shipping_type;
                shipment.Weight        = s.Shipping_weight;
                shipment.Ship_regnum   = s.Ship_regnum;
                shipment.Status        = s.Status;
                context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var shipment = new Shipment();
            editShipmentViewModel esvm = new editShipmentViewModel();

            using (EntityDataModelContainer context = new EntityDataModelContainer())
            {
                shipment = context.Shipments.Where(s => s.Id == id).FirstOrDefault();

                esvm.Id              = shipment.Id;
                esvm.Shipping_date   = shipment.Shipping_date;
                esvm.Destination     = shipment.Destination;
                esvm.Shipping_type   = shipment.Type;
                esvm.Shipping_weight = shipment.Weight;
                esvm.Ship_regnum     = shipment.Ship_regnum;
                esvm.Status          = shipment.Status;
            }
            esvm.listItem  = loadList();
            esvm.listItem2 = new List <SelectListItem>();
            loadList2(esvm.listItem2);
            return(View(esvm));
        }