public HttpResponseMessage RemoveLeaveAllocation(LeaveAllocationRemoveDTO objLeave) { HttpResponseMessage message; try { // LeaveAllocationDataAccessLayer dal = new LeaveAllocationDataAccessLayer(); var dynObj = new { result = _leave.DeactivateLeaveAllocation(objLeave) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = " Something wrong,try Again!" }); ErrorLog.CreateErrorMessage(ex, "Leave", "DeactivateLeaveAllocation"); } return(message); }
public bool DeactivateLeaveAllocation(LeaveAllocationRemoveDTO objLeave) { bool res = false; SqlCommand sqlcmd = new SqlCommand("spDeleteLeaveAllocation"); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.AddWithValue("@Id", objLeave.Id); //sqlcmd.Parameters.AddWithValue("@Active", objLeave.Active); sqlcmd.Parameters.AddWithValue("@ActionBy", objLeave.ActionBy); int result = new DbLayer().ExecuteNonQuery(sqlcmd); if (result != Int32.MaxValue) { res = true; } return(res); }