public int Insert(FacilitySchedule saveThis) { try { _db.FacilitySchedules.InsertOnSubmit(saveThis); _db.SubmitChanges(); return saveThis.Id; } catch (Exception e) { throw new Exception(e.Message); } }
public void Delete(FacilitySchedule deleteThis) { try { if (deleteThis.Id > 0) { _db.FacilitySchedules.DeleteOnSubmit(deleteThis); _db.SubmitChanges(ConflictMode.FailOnFirstConflict); } } catch (Exception e) { throw new Exception(e.Message); } }
public void Update(FacilitySchedule updateThis) { try { _db.FacilitySchedules.Attach(updateThis); _db.Refresh(RefreshMode.KeepCurrentValues, updateThis); _db.SubmitChanges(); } catch (Exception e) { throw new Exception(e.Message); } }