// This method deletes a record in the table. // Change this method to alter how records are deleted. public static int Delete(Location x) { Chapter08 db = Chapter08.CreateDataContext(); db.Locations.Remove(x); db.SubmitChanges(); return(1); }
// This method inserts a new record in the table. // Change this method to alter how records are inserted. public static int Insert(Location x) { Chapter08 db = Chapter08.CreateDataContext(); db.Locations.Add(x); db.SubmitChanges(); return(1); }
// This method updates a record in the table. // Change this method to alter how records are updated. public static int Update(Location original_x, Location x) { Chapter08 db = Chapter08.CreateDataContext(); db.Locations.Attach(original_x); original_x.City = x.City; original_x.State = x.State; original_x.Creation = x.Creation; original_x.Modified = x.Modified; db.SubmitChanges(); return(1); }
// This method updates a record in the table. // Change this method to alter how records are updated. public static int Update(Person original_x, Person x) { Chapter08 db = Chapter08.CreateDataContext(); db.Persons.Attach(original_x); original_x.FirstName = x.FirstName; original_x.LastName = x.LastName; original_x.LocationID = x.LocationID; original_x.Creation = x.Creation; original_x.Modified = x.Modified; db.SubmitChanges(); return(1); }