// Method Name: Delete // Purpose: Deletes an employee object from the database // Accepts: a String // Returns: bool public bool Delete(string id) { bool deleteOk = false; ObjectId empid = new ObjectId(id); try { DbContext ctx = new DbContext(); Employee emp = ctx.Employees.FirstOrDefault(e => e._id == empid); ctx.Delete<Employee>(emp, "employees"); deleteOk = true; } catch(Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Delete"); } return deleteOk; }
public bool Delete(string id) { bool deleteOk = false; ObjectId prbId = new ObjectId(id); try { DbContext ctx = new DbContext(); Problem prb = ctx.Problems.FirstOrDefault(p => p._id == prbId); ctx.Delete<Problem>(prb, "problems"); deleteOk = true; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "ProblemDAO", "Delete"); } return deleteOk; }
public bool Delete(string id) { bool deleteOk = false; ObjectId depId = new ObjectId(id); try { DbContext ctx = new DbContext(); Department dep = ctx.Departments.FirstOrDefault(d => d._id == depId); ctx.Delete<Department>(dep, "departments"); deleteOk = true; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Delete"); } return deleteOk; }
// Method Name: Delete // Purpose: Deletes an employee object from the database // Accepts: a String // Returns: bool public bool Delete(string id) { bool deleteOk = false; ObjectId empid = new ObjectId(id); try { DbContext ctx = new DbContext(); Employee emp = ctx.Employees.FirstOrDefault(e => e._id == empid); ctx.Delete <Employee>(emp, "employees"); deleteOk = true; } catch (Exception e) { DALUtils.ErrorRoutine(e, "EmployeeDAO", "Delete"); } return(deleteOk); }
public bool Delete(string id) { bool deleteOk = false; ObjectId callid = new ObjectId(id); try { DbContext ctx = new DbContext(); Call call = ctx.Calls.FirstOrDefault(c => c._id == callid); ctx.Delete <Call>(call, "calls"); deleteOk = true; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "CallDAO", "Delete"); } return(deleteOk); }
public bool Delete(string id) { bool deleteOk = false; ObjectId depid = new ObjectId(id); try { DbContext ctx = new DbContext(); Department dep = ctx.Departments.FirstOrDefault(d => d._id == depid); ctx.Delete <Department>(dep, "departments"); deleteOk = true; } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "DepartmentDAO", "Delete"); } return(deleteOk); }