public static bool AddExistingStaff(ExistingStaff estf) { try { using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities()) { db.ExistingStaffs.Add(estf); db.SaveChanges(); return(true); } } catch (Exception ex) { // Utility.WriteError("Error Msg: " + ex.Message); throw ex; } }
public static bool DeleteExistingRecord(ExistingStaff staff) { try { bool rst = false; using (var db = new BudgetCaptureDBEntities()) { db.Entry(staff).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); rst = true; } return(rst); } catch (Exception ex) { throw ex; } }
public static bool UpdateExistingStaff(ExistingStaff staff) { try { bool rst = false; using (var db = new BudgetCaptureDBEntities()) { db.ExistingStaffs.Attach(staff); db.Entry(staff).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); rst = true; } return(rst); } catch (Exception ex) { //Utility.WriteError("Error Msg: " + ex.InnerException); throw ex; } }