public ActionResult ShipperDelete(int id)
        {
            shipper shipper = models.shippers.FirstOrDefault(x => x.shipper_id == id);

            models.shippers.Remove(shipper);
            models.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult ShipperUpdate(shipper s)
        {
            shipper shipper = models.shippers.FirstOrDefault(x => x.shipper_id == s.shipper_id);

            shipper.first_name            = s.first_name;
            shipper.last_name             = s.last_name;
            shipper.identification_number = s.identification_number;
            models.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public shipper Createshipper(Int32?shipperID = null, String companyName = null, String phone = null)
        {
            shipper value = CreateObject <shipper>();

            if (shipperID != null)
            {
                value.ShipperID = shipperID.Value;
            }
            if (companyName != null)
            {
                value.CompanyName = companyName;
            }
            if (phone != null)
            {
                value.Phone = phone;
            }
            return(value);
        }
 public ActionResult ShipperAdd(shipper s)
 {
     models.shippers.Add(s);
     models.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public ActionResult ShipperUpdate(int id)
        {
            shipper shipper = models.shippers.FirstOrDefault(x => x.shipper_id == id);

            return(View(shipper));
        }
コード例 #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the shippers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToshippers(shipper shipper)
 {
     base.AddObject("shippers", shipper);
 }