public void DeleteRequest(long requestId) { try { using (var context = new PTOMEntities()) { var REQ = context.PTO_REQUEST.FirstOrDefault(x => x.PTO_REQUEST_ID == requestId); if (REQ != null) { context.DeleteObject(REQ); context.SaveChanges(); } } } catch (Exception ex) { LoggingHelper.LogServiceMessage(LoggingHelper.MessageType.Error, string.Empty, ex); throw; } }
public void DeleteEmployee(long employeeId) { try { using (var context = new PTOMEntities()) { var EMPLOYEE = context.EMPLOYEE.FirstOrDefault(emp => emp.EMPLOYEE_ID == employeeId); if (EMPLOYEE != null) { context.DeleteObject(EMPLOYEE); context.SaveChanges(); } } } catch (Exception ex) { LoggingHelper.LogServiceMessage(LoggingHelper.MessageType.Error, string.Empty, ex); throw; } }