public HttpResponseMessage RemoveEmployee(EmployeeRemoveDTO employee) { HttpResponseMessage message; try { // EmployeeDataAccessLayer dal = new EmployeeDataAccessLayer(); var dynObj = new { result = _employee.RemoveEmployee(employee) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = " Something wrong,try Again!" }); ErrorLog.CreateErrorMessage(ex, "Employee", "DeactiveEmployeeById"); } return(message); }
public bool RemoveEmployee(EmployeeRemoveDTO objRemoveEmp) { bool res = false; SqlCommand sqlcmd = new SqlCommand("spDeleteEmployee"); sqlcmd.Parameters.AddWithValue("@Id", objRemoveEmp.Id); sqlcmd.Parameters.AddWithValue("@Active", objRemoveEmp.Active); sqlcmd.Parameters.AddWithValue("@ActionBy", objRemoveEmp.ActionBy); sqlcmd.CommandType = CommandType.StoredProcedure; int result = new DbLayer().ExecuteNonQuery(sqlcmd); if (result != Int32.MaxValue) { res = true; } return(res); }