public HttpResponseMessage UpdateShift(ShiftUpdateDTO shift) { HttpResponseMessage message; try { // ShiftMasterDataAccessLayer dal = new ShiftMasterDataAccessLayer(); var dynObj = new { result = _Shift.UpdateShift(shift) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = " Somthing wrong,try Again!" }); ErrorLog.CreateErrorMessage(ex, "Shift", "UpdateShift"); } return(message); }
public bool UpdateShift(ShiftUpdateDTO shift) { bool res = false; SqlCommand SqlCmd = new SqlCommand("spUpdateShift"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@ShiftId", shift.ShiftId); SqlCmd.Parameters.AddWithValue("@ShiftName", shift.ShiftName); SqlCmd.Parameters.AddWithValue("@ModifiedBy", shift.ModifiedBy); SqlCmd.Parameters.AddWithValue("@Active", shift.Active); int result = new DbLayer().ExecuteNonQuery(SqlCmd); if (result != Int32.MaxValue) { res = true; } return(res); }