public ActionResult Create(ShipmentDetails shipmentdetails)
        {
            if (ModelState.IsValid)
            {
                db.ShipmentDetails.Add(shipmentdetails);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(shipmentdetails);
        }
 //public static ShipmentDetails AddNewShipmentDetail(int invoiceNo)
 //{
 //    var detail = new ShipmentDetails();
 //    detail.ItemNo = "-";
 //    ent.ShipmentDetails.AddObject(detail);
 //    return detail;
 //}
 //public static List<ShipmentDetails> GetShipmentShipmentDetails(int shipmentID)
 //{
 //    var shipment = ent.Shipments.FirstOrDefault(i => i.ShipmentID == shipmentID && !i.IsCancelled);
 //    return
 //        shipment.ShipmentDetails
 //           .OrderBy(i => i.ItemNo)
 //           .ThenBy(i => i.BoxNumber)
 //           .ToList();
 //}
 public static void DeleteShipmentDetail(ShipmentDetails detail)
 {
     ent.ShipmentDetails.Remove(detail);
 }
 public ActionResult Edit(ShipmentDetails shipmentdetails)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipmentdetails).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(shipmentdetails);
 }
 //public static ins_data GetInsDataForInvoice(int invs_num)
 //{
 //    return ent.ins_data.FirstOrDefault(i => i.INVS_NUM == invs_num);
 //}
 //public static List<InvoiceDetail> GetInvtLogDataForInvoice(int invs_num)
 //{
 //    //ignore items with no weight and dimension information
 //    return
 //       (from i in ent.invt_log.Where(i => i.INVS_NUM == invs_num)
 //        join d in ent.inv_detl on i.PROD_CD equals d.PROD_CD
 //        where d.CASE_HI.HasValue && d.CASE_LEN.HasValue && d.CASE_WI.HasValue && d.CASE_WT.HasValue
 //        select new InvoiceDetail { ProductCode = i.PROD_CD, ProductQuantity = i.PROD_QTY, UnitPrice = i.UNIT_PRS }
 //        ).OrderBy(i => i.ProductCode).ToList();
 //}
 //public static inv GetInv(string productCode)
 //{
 //    return (from item in ent.invs
 //            where item.PROD_CD == productCode
 //            select item).FirstOrDefault();
 //}
 //public static inv_detl GetInvDetl(string productCode)
 //{
 //    return (from item in ent.inv_detl
 //            where item.PROD_CD == productCode
 //            select item).FirstOrDefault();
 //}
 //public static FromAddresses GetFromAddress(int id)
 //{
 //    return ent.FromAddresses.FirstOrDefault(i => i.FromAddressID == id);
 //}
 //public static List<FromAddresses> GetAllFromAddresses()
 //{
 //    return ent.FromAddresses.OrderBy(i => i.FromAddressID).ToList();
 //}
 //public static List<ListItem> GetAllFromAddressesForDdl()
 //{
 //    return ent.FromAddresses.OrderBy(i => i.FromAddressID).ToList().Select(i => new ListItem { Value = i.FromAddressID.ToString(), Text = i.CompanyName }).ToList();
 //}
 //public static void AddNewFromAddress(string companyName, string contact,
 //    string address1, string address2, string city, string countryCode,
 //    string postalCode, string stateCode, string telephone)
 //{
 //    var address = new FromAddresses();
 //    address.CompanyName = companyName;
 //    address.Contact = contact;
 //    address.Address1 = address1;
 //    address.Address2 = address2;
 //    address.City = city;
 //    address.CountryCode = countryCode;
 //    address.PostalCode = postalCode;
 //    address.StateCode = stateCode;
 //    address.Telephone = telephone;
 //    ent.FromAddresses.AddObject(address);
 //}
 //public static void AddNewFromAddress(FromAddresses newAddress)
 //{
 //    ent.FromAddresses.AddObject(newAddress);
 //}
 //public static FromAddresses AddNewFromAddress()
 //{
 //    var address = new FromAddresses();
 //    ent.FromAddresses.AddObject(address);
 //    return address;
 //}
 //public static void DeleteFromAddress(FromAddresses address)
 //{
 //    ent.FromAddresses.DeleteObject(address);
 //}
 public static void AddNewShipmentDetail(ShipmentDetails detail)
 {
     ent.ShipmentDetails.Add(detail);
 }