Esempio n. 1
0
        public static int spremi_preko(ShipmentItem d)
        {
            try
            {
                using (var db = new PodaciContext())
                {
                    ShipmentItem temp = db.ShipmentItems.Include("Shipment").FirstOrDefault(x => x.Barcode == d.Barcode);

                    if (temp != null)
                    {
                        d.Id          = temp.Id;
                        d.ShipmentId  = temp.ShipmentId;
                        d.Shipment.Id = temp.Shipment.Id;
                        db.Set <ShipmentItem>().AddOrUpdate(d);
                        db.Set <Shipment>().AddOrUpdate(d.Shipment);
                        //db.Entry(d).State = EntityState.Modified;
                        spremi_dodatno(db);
                        return(1);
                    }
                }
                return(-1);
            }
            catch (Exception ee)
            {
                return(-1);
            }
        }