public HttpResponseMessage GetTimeSlot(int itemId, int codeCampId) { try { var timeSlot = TimeSlotDataAccess.GetItem(itemId, codeCampId); // removing this prevented the saved/retrieved time from being offset to being about 4 hours off //if (timeSlot != null) //{ // timeSlot.BeginTime = timeSlot.BeginTime.ToLocalTime(); // timeSlot.EndTime = timeSlot.EndTime.ToLocalTime(); //} var response = new ServiceResponse <TimeSlotInfo> { Content = timeSlot }; if (timeSlot == null) { ServiceResponseHelper <TimeSlotInfo> .AddNoneFoundError("timeSlot", ref response); } return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson())); } catch (Exception ex) { Exceptions.LogException(ex); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE)); } }
public HttpResponseMessage UpdateTimeSlot(TimeSlotInfo timeSlot) { try { var updatesToProcess = false; var originalTimeSlot = TimeSlotDataAccess.GetItem(timeSlot.TimeSlotId, timeSlot.CodeCampId); updatesToProcess = TimeSlotHasUpdates(ref originalTimeSlot, ref timeSlot); if (updatesToProcess) { originalTimeSlot.LastUpdatedByDate = DateTime.Now; originalTimeSlot.LastUpdatedByUserId = UserInfo.UserID; TimeSlotDataAccess.UpdateItem(originalTimeSlot); } var savedTimeSlot = TimeSlotDataAccess.GetItem(timeSlot.TimeSlotId, timeSlot.CodeCampId); // removing this prevented the saved/retrieved time from being offset to being about 4 hours off //if (savedTimeSlot != null) //{ // savedTimeSlot.BeginTime = savedTimeSlot.BeginTime.ToLocalTime(); // savedTimeSlot.EndTime = savedTimeSlot.EndTime.ToLocalTime(); //} var response = new ServiceResponse <TimeSlotInfo> { Content = savedTimeSlot }; return(Request.CreateResponse(HttpStatusCode.OK, response.ObjectToJson())); } catch (Exception ex) { Exceptions.LogException(ex); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ERROR_MESSAGE)); } }