protected void addRecord(object sender, EventArgs e) { //System.Diagnostics.Debug.WriteLine(shipname.Value); var newshipinfo = new ShipmentActivity { Shipname = shipname.Value, ShipmentSize = shipmentsize.Value, ShipmentDate = shipmentdate.Value, ShipmentLocation = shipmentlocation.Value, ShipmentStatus = shipmentstatus.Value }; var db = new ShipmentActivityContext(); db.ShipmentActivities.Add(newshipinfo); db.SaveChanges(); Response.Redirect(Request.RawUrl); }
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); }