コード例 #1
0
        protected void deleteRecord(object sender, EventArgs e)
        {
            var db = new ShipmentActivityContext();
            IQueryable <ShipmentActivity> query = db.ShipmentActivities;
            int sid = Int32.Parse(shipmentid.Value);

            query = query.Where(p => p.ShipmentID == sid);
            if (query.Count() != 0)
            {
                db.Entry(query.First()).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
            }
        }
コード例 #2
0
        protected void updateRecord(object sender, EventArgs e)
        {
            int sid         = Int32.Parse(shipmentid.Value);
            var newshipinfo = new ShipmentActivity
            {
                ShipmentID       = sid,
                Shipname         = shipname.Value,
                ShipmentSize     = shipmentsize.Value,
                ShipmentDate     = shipmentdate.Value,
                ShipmentLocation = shipmentlocation.Value,
                ShipmentStatus   = shipmentstatus.Value
            };

            var db = new ShipmentActivityContext();

            db.Entry(newshipinfo).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            Response.Redirect(Request.RawUrl);
        }