public HttpResponseMessage UpdateSystemSubscription(InboxSubscriptionViewModel post)
        {
            try
            {
                var userPreferencesController = UserPreferencesController.Instance;
                var userPreference            = new UserPreference
                {
                    PortalId = this.UserInfo.PortalID,
                    UserId   = this.UserInfo.UserID,
                    MessagesEmailFrequency      = (Frequency)post.MsgFreq,
                    NotificationsEmailFrequency = (Frequency)post.NotifyFreq,
                };
                userPreferencesController.SetUserPreference(userPreference);

                return(this.Request.CreateResponse(HttpStatusCode.OK, userPreferencesController.GetUserPreference(this.UserInfo)));
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #2
0
        public HttpResponseMessage UpdateSystemSubscription(InboxSubscriptionViewModel post)
        {
            try
            {
                var userPreferencesController = UserPreferencesController.Instance;
                var userPreference            = new UserPreference
                {
                    PortalId = this.UserInfo.PortalID,
                    UserId   = this.UserInfo.UserID,
                    MessagesEmailFrequency      = (Frequency)post.MsgFreq,
                    NotificationsEmailFrequency = (Frequency)post.NotifyFreq,
                };
                userPreferencesController.SetUserPreference(userPreference);

                return(this.Request.CreateResponse(HttpStatusCode.OK, userPreferencesController.GetUserPreference(this.UserInfo)));
            }
            catch (Exception ex)
            {
                var message = "An unexpected error occurred while attempting to update the system subscriptions, consult the server logs for more information.";
                Exceptions.LogException(ex);
                return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, message));
            }
        }