Ejemplo n.º 1
0
        public Response UpdateWorkshopBooking(UpdateWorkshopBooking update)
        {
            try
            {
                base.CheckApplicationKey();
                if (update == null)
                {
                    return new Response()
                    {
                        IsSuccess = false,
                        DisplayMessage = ErrorMessages.UPDATE_REQ_ERROR
                    };
                }

                var workshop = WorkshopDb.GetWorkshopDetail(update.WorkshopId);
                if (workshop == null)
                {
                    return new Response()
                    {
                        IsSuccess = false,
                        DisplayMessage = ErrorMessages.WORKSHOP_NOT_FOUND
                    };
                }
                if (DateTime.UtcNow.AddDays(-7) > workshop.EndDate && update.Notes != null)
                {
                    return new Response()
                    {
                        IsSuccess = false,
                        DisplayMessage = ErrorMessages.NOTES_LOCKOUT
                    };
                }

                WorkshopDb.UpdateWorkshopBooking(update);
            }
            catch (Exception e)
            {
                string msg = CreateExceptionMessage(e);
                return new Response()
                {
                    IsSuccess = false,
                    DisplayMessage = string.Format(ErrorMessages.UPDATE_WORKSHOP_BOOKING_ERROR, msg)
                };
            }

            return new Response()
            {
                IsSuccess = true
            };
        }
Ejemplo n.º 2
0
 public static void UpdateWorkshopBooking(UpdateWorkshopBooking update)
 {
     using (HELPSEntities ctx = new HELPSEntities())
     {
         ctx.prcUpdateWorkshopBooking(update.WorkshopId, update.StudentId,
             update.Canceled, update.Attended, update.UserId, update.Notes);
     }
 }