private static void AddUserPreferenceToTable(DataTable table, UserPreference userPreference)
 {
     table.Rows.Add(new object[] {
         1, 
         userPreference.PortalId,
         userPreference.UserId, 
         userPreference.MessagesEmailFrequency, 
         userPreference.NotificationsEmailFrequency,
     });
 }
 public void SetUserPreference(UserPreference userPreference)
 {
     dataService.SetUserPreference(userPreference.PortalId, userPreference.UserId, Convert.ToInt32(userPreference.MessagesEmailFrequency), Convert.ToInt32(userPreference.NotificationsEmailFrequency));
 }
 internal static IDataReader CreateUserPreferenceReader(UserPreference userPreference)
 {
     var table = CreateUserPreferenceTable();
     AddUserPreferenceToTable(table, userPreference);
     return table.CreateDataReader();
 }
 public HttpResponseMessage UpdateSystemSubscription(InboxSubscriptionViewModel post)
 {
     try
     {               
         var userPreferencesController = UserPreferencesController.Instance;
         var userPreference = new UserPreference
             {
                 PortalId = UserInfo.PortalID,
                 UserId = UserInfo.UserID,
                 MessagesEmailFrequency = (Frequency) post.MsgFreq,
                 NotificationsEmailFrequency = (Frequency) post.NotifyFreq
             };
         userPreferencesController.SetUserPreference(userPreference);
         
         return Request.CreateResponse(HttpStatusCode.OK, userPreferencesController.GetUserPreference(UserInfo));
     }
     catch (Exception ex)
     {
         Exceptions.LogException(ex);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
     }
 }