コード例 #1
0
		public ActionResult Settings(UserSettingsViewModel userSettingsViewModel)
		{
			if(!this.ValidateAndAppendMessages(userSettingsViewModel))
			{
				return View(userSettingsViewModel);
			}

			// Check Email Address
			if (this.UserService.EmailAddressIsInUse(userSettingsViewModel.EmailAddress, this.ActiveUser.UserId))
			{
				this.AppendMessage(new ErrorMessage { Text = "The email address you entered is already in use." });
				return View(userSettingsViewModel);
			}

			// Check Username Uniqueness
			if (this.UserService.UsernameIsInUse(this.ActiveUser.UserId, userSettingsViewModel.Username))
			{
				this.AppendMessage(new ErrorMessage { Text = "The requested username is already in use" });
				return View(userSettingsViewModel);
			}

			using(var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork())
			{
				try
				{
					var user = this.UserService.GetUserById(this.ActiveUser.UserId);

					var originalUsername = user.Username;

					user = Mapper.Map(userSettingsViewModel, user);

					// Cust Username Flag
					if (!user.HasCustomUsername && originalUsername != user.Username)
					{
						user.HasCustomUsername = true;
					}

					user.EmailAddress = userSettingsViewModel.EmailAddress.Trim();
					user.DateModified = DateTime.Now;

					unitOfWork.Commit();

					this.UserResolver.Update(Mapper.Map(user, new UserSummary()));

					return new EmptyResult();
				}
				catch (Exception ex)
				{
					unitOfWork.Rollback();
					this.LogHandledException(ex);
					return this.Issue500();
				}				
			}
		}
コード例 #2
0
 public UserSettingPage()
 {
     try
     {
         InitializeComponent();
         _model = new UserSettingsViewModel();
         Page_Load();
     }
     catch (Exception ex)
     {
         var exceptionHandler = new ExceptionHandler(typeof(UserSettingPage).FullName, ex);
     }
 }
コード例 #3
0
    public async Task <ActionResult> Save(UserSettingsViewModel vm)
    {
        string key = UserSettings.GetKey(User.CustomIdentity.PlayerId !);

        UpdateUserSettingsCommandHandler.Command command = new(
            key,
            vm.RosterMailEnabled,
            vm.AbsenceMailEnabled,
            vm.MatchResultMailEnabled);
        await ExecuteCommand(command);

        FlashInfo("Inställningarna sparades.");
        return(RedirectToAction("Index", "UserProfile"));
    }
コード例 #4
0
        public async Task <JsonResult> SaveSettings(UserSettingsViewModel userSettingsViewModel)
        {
            try
            {
                string response = await APICallerExtensions.APICallAsync("User/SaveSettings", userSettingsViewModel, false, HttpContext.Session.GetObject(StorageType.Token).ToString());

                if (response.ToLower().Contains("exception:"))
                {
                    ModelState.AddModelError(string.Empty, response);
                    return(Json(new
                    {
                        result = false,
                        error = response
                    }));
                }
                var content = JsonConvert.DeserializeObject <SingleResponse <ApplicationUser> >(response);
                if (!content.DidError)
                {
                    if (content.Model.IsCompanySelected)
                    {
                        LocalStorageExtensions.Store(StorageType.IsCompanySelected, "true");
                    }
                    if (content.Model.IsShopSelected)
                    {
                        LocalStorageExtensions.Store(StorageType.IsShopSelected, "true");
                    }

                    return(Json(new
                    {
                        content.Model,
                    }));
                }
                else
                {
                    return(Json(new
                    {
                        result = false,
                        error = content == null ? "Content is null or empty" : content.ErrorMessage
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    result = false,
                    error = ex.Message
                }));
            }
        }
コード例 #5
0
        public ActionResult Index(int userid, string referrer)
        {
            if (referrer == "sharemeal")
            {
                Session[referrer] = "sharemeal";
            }

            UserSetting           usersetting = _service.GetById(userid);
            UserSettingsViewModel usvm        = Mapper.Map <UserSetting, UserSettingsViewModel>(usersetting);



            return(View(usvm));
        }
コード例 #6
0
        public ActionResult Index(UserSettingsViewModel settings)
        {
            if (this.ModelState.IsValid)
            {
                var user = this.Data.Users.GetByUsername(this.User.Identity.Name);
                this.UpdateUserSettings(user.UserSettings, settings);
                this.Data.SaveChanges();

                this.TempData.Add(GlobalConstants.InfoMessage, Resource.Settings_were_saved);
                return(this.RedirectToAction(GlobalConstants.Index, new { controller = "Profile", area = "Users" }));
            }

            return(this.View(settings));
        }
コード例 #7
0
ファイル: UserController.cs プロジェクト: nkhedr1/Bug-Tracker
        public ActionResult EditUserDetails(string id)
        {
            var userId = id;

            var loggedInUser = DbContext.Users.FirstOrDefault(user =>
                                                              user.Id == userId);

            var EditUserDetails = new UserSettingsViewModel();

            EditUserDetails.Email     = loggedInUser.Email;
            EditUserDetails.FirstName = loggedInUser.FirstName;
            EditUserDetails.Id        = loggedInUser.Id;

            return(View(EditUserDetails));
        }
        public async Task <ProcessResult> UpdateUserSettingsAsync(UserSettingsViewModel model)
        {
            Func <Task> action = async() =>
            {
                var user = await this.userManager.FindByIdAsync(CurrentUser.Id.ToString());

                user.NormalizedUserName = model.UserName.ToUpper();
                user.UserName           = model.UserName;
                user.AvatarURL          = model.AvatarURL;

                await context.SaveChangesAsync();
            };

            return(await Process.RunAsync(action));
        }
コード例 #9
0
ファイル: UserController.cs プロジェクト: nkhedr1/Bug-Tracker
        public ActionResult Settings()
        {
            var userId = User.Identity.GetUserId();

            var loggedInUser = DbContext.Users.FirstOrDefault(user =>
                                                              user.Id == userId);

            var userSettingsViewPage = new UserSettingsViewModel();

            userSettingsViewPage.Email     = loggedInUser.Email;
            userSettingsViewPage.FirstName = loggedInUser.FirstName;
            userSettingsViewPage.Id        = loggedInUser.Id;

            return(View(userSettingsViewPage));
        }
コード例 #10
0
ファイル: UserController.cs プロジェクト: nkhedr1/Bug-Tracker
        public ActionResult ViewUserDetails(string id)
        {
            var userId = id;

            var loggedInUser = DbContext.Users.FirstOrDefault(user =>
                                                              user.Id == userId);

            var userDetailsViewPage = new UserSettingsViewModel();

            userDetailsViewPage.Email     = loggedInUser.Email;
            userDetailsViewPage.FirstName = loggedInUser.FirstName;
            userDetailsViewPage.Id        = loggedInUser.Id;

            return(View(userDetailsViewPage));
        }
コード例 #11
0
ファイル: ManageController.cs プロジェクト: EwiPraca/ewipraca
        public ActionResult UserSettings()
        {
            string userId = User.Identity.GetUserId();

            if (!string.IsNullOrEmpty(userId))
            {
                RedirectToAction("Index", "Home");
            }

            var settings = Mapper.Map <List <UserSettingViewModel> >(_settingService.AllUserSetting(userId));

            var existingSettingsId = settings.Select(x => x.Id).ToList();

            var defaultSettings = _settingService.AllSettings().Where(x => !existingSettingsId.Contains(x.Id)).ToList();

            foreach (var setting in defaultSettings)
            {
                var userSettingViewModel = new UserSettingViewModel()
                {
                    Id                 = 0,
                    SettingId          = setting.Id,
                    SettingDescription = setting.SettingDescription,
                    SettingType        = setting.SettingValueType
                };

                if (setting.SettingValueType == "System.Int32")
                {
                    userSettingViewModel.SettingValue = _defaultNumberOfDays.ToString();
                }
                else
                {
                    userSettingViewModel.SettingValue = string.Empty;
                }

                settings.Add(userSettingViewModel);
            }

            var user = _applicationUserManager.FindById(userId);

            var model = new UserSettingsViewModel()
            {
                UserId           = userId,
                Settings         = settings,
                TwoFactorEnabled = user.TwoFactorEnabled
            };

            return(View(model));
        }
コード例 #12
0
        public IActionResult Settings()
        {
            var user = GetUser();

            if (user == null)
            {
                return(Unauthorized("User not found."));
            }
            var model = new UserSettingsViewModel
            {
                User      = user,
                Timezones = Database.Timezones.ToList()
            };

            return(View(model));
        }
コード例 #13
0
        public ActionResult Index(UserSettingsViewModel settings)
        {
            return(this.RedirectToAction("ExternalNotify", "Account", new { area = string.Empty }));

            // if (this.ModelState.IsValid)
            // {
            //    var user = this.Data.Users.GetByUsername(this.User.Identity.Name);
            //    this.UpdateUserSettings(user.UserSettings, settings);
            //    this.Data.SaveChanges();

            // this.TempData.Add(GlobalConstants.InfoMessage, Resource.Settings_were_saved);
            //    return this.RedirectToAction(GlobalConstants.Index, new { controller = "Profile", area = "Users" });
            // }

            // return this.View(settings);
        }
        public async Task <IActionResult> UpdateUserSettings([FromBody] UserSettingsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _profileService.UpdateUserSettingsAsync(model);

            if (!result.Succeeded)
            {
                return(BadRequest(result.Errors));
            }

            return(Ok());
        }
コード例 #15
0
        public async Task <IActionResult> GetMySettings()
        {
            try
            {
                var user = await GetCurrentAuthenticatedUser();

                var userViewModel = new UserSettingsViewModel(user);

                return(Ok(userViewModel));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                return(BadRequest(new ErrorMessage(ex)));
            }
        }
コード例 #16
0
        //
        // GET: /Settings/Edit/5

        public ActionResult Edit(int userid)
        {
            UserSetting usersetting = _service.GetById(userid);

            if (usersetting == null)
            {
                return(HttpNotFound());
            }

            UserSettingsViewModel usvm = Mapper.Map <UserSetting, UserSettingsViewModel>(usersetting);

            usvm = PopulateDropDown(usvm, usersetting);


            return(View(usvm));
        }
コード例 #17
0
        public IActionResult UserSettings(UserSettingsViewModel vm)
        {
            var model = new UserSettingsViewModel();
            var note  = new Note();

            model.AspNetUserId = vm.AspNetUserId;
            model.CompanyId    = vm.CompanyId;
            model.Note         = vm.Note;

            note.CompanyId    = vm.CompanyId;
            note.Description  = vm.Note;
            note.AspNetUserId = User.Identity.GetUserId();

            var createNoteOperation = _noteBO.Create(note);

            return(View(model));
        }
コード例 #18
0
        public ActionResult Index(UserSettingsViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (UnitOfWork work = new UnitOfWork())
                {
                    work.UserRepository.UpdateUserSettings(WebSecurity.CurrentUserId, model.CommunicationSettings, model.PrivacySettings);
                    work.SaveChanges();
                }

                // TODO: Figure out why model isn't being refreshed properly
                return(RedirectToAction("Index"));
            }

            // TODO: refresh model?
            return(View(model));
        }
コード例 #19
0
        public ActionResult Edit(UserSettingsViewModel usvm)
        {
            if (ModelState.IsValid)
            {
                UserSetting usersetting = db.UserSettings.Find(usvm.UserSettingsID);
                usersetting.ReceiveEmailNotification      = usvm.ReceiveEmailNotificationID;
                usersetting.ReceiveMobileTextNotification = usvm.ReceiveMobileTextNotificationID;
                usersetting.NotificationFrequencyID       = (String.IsNullOrEmpty(usvm.NotificationFrequencyID) ? 0 : Convert.ToInt32(usvm.NotificationFrequencyID));
                usersetting.PrivacySettingsID             = usvm.PrivacySettingID;

                UserSetting us = Mapper.Map <UserSettingsViewModel, UserSetting>(usvm);
                db.Entry(usersetting).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { userID = WebSecurity.CurrentUserId }));
            }
            else
            {
                UserSetting usersetting = db.UserSettings.Find(usvm.UserSettingsID);

                UserSettingsViewModel usvm1 = Mapper.Map <UserSetting, UserSettingsViewModel>(usersetting);
                usvm.ActivityType = usvm1.ActivityType;

                var PrivacySettingOptions = from b in db.LKUPPrivacySettings select b;

                IEnumerable <LKUPPrivacySetting> PrivacySettings = PrivacySettingOptions.ToList();
                usvm.PrivacySettingList = PrivacySettings.Select(x => new SelectListItem
                {
                    Value = x.PrivacySettingsID.ToString(),
                    Text  = x.PrivacySettings.ToString()
                });

                var Notification = from b in db.NotificationFrequencies select b;

                IEnumerable <NotificationFrequency> NotificationFrequencyOptions = Notification.ToList();
                usvm.NotificationFrequencyList = NotificationFrequencyOptions.Select(x => new SelectListItem
                {
                    Value = x.NotificationFrequencyID.ToString(),
                    Text  = x.Description.ToString()
                });


                return(View(usvm));
            }

            return(View(usvm));
        }
        public async Task <ProcessResult <UserSettingsViewModel> > GetUserSettingsAsync()
        {
            Func <Task <UserSettingsViewModel> > action = async() =>
            {
                var user = await this.userManager.FindByIdAsync(CurrentUser.Id.ToString());

                var userSettings = new UserSettingsViewModel
                {
                    UserName  = user.UserName,
                    AvatarURL = String.IsNullOrEmpty(user.AvatarURL) ? "person.png" : user.AvatarURL
                };

                return(userSettings);
            };

            return(await Process.RunAsync(action));
        }
コード例 #21
0
        public async Task <IActionResult> UpdateUserSettings([FromBody] UserSettingsViewModel userSettingsViewModel)
        {
            try
            {
                var user = await GetCurrentAuthenticatedUser();

                user.UpdateFromUserViewModel(userSettingsViewModel);

                await _userRepository.UpdateUser(UserManager, user);

                return(Ok(userSettingsViewModel));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                return(BadRequest(new ErrorMessage(ex)));
            }
        }
コード例 #22
0
        public ActionResult UserSettingsGrid_EditRows(UserSetting editedOrder)
        {
            // Get the grid and database (northwind) models
            var gridModel = new UserSettingsViewModel();

            // If we are in "Edit" mode
            if (gridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.EditRow)
            {
            }
            if (gridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.AddRow)
            {
            }
            if (gridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.DeleteRow)
            {
            }

            return(RedirectToAction("Index"));
        }
コード例 #23
0
        private async Task <IdentityResult> UpdateEmail(UserSettingsViewModel userSettingsViewModel, User user)
        {
            var existingEmail = user.EmailAddress?.Trim();
            var newEmail      = userSettingsViewModel.EmailAddress?.Trim();

            var emailNotChanged = existingEmail.IgnoreCaseEqual(newEmail);

            if (emailNotChanged)
            {
                return(IdentityResult.Success);
            }

            var emailTaken = IsEmailTakenByAnotherUser(user.Id, newEmail);

            return(emailTaken
                ? EmailTakenResult()
                : await _userManager.SetEmailAsync(user, newEmail));
        }
コード例 #24
0
        public async Task should_use_username_as_display_name_if_update_display_name_to_null()
        {
            var user = _theApp.MockUser();

            user.DisplayName = StringUtility.Random();
            _userRepo.Update(user);
            var settingViewModel = new UserSettingsViewModel();
            var userCtrl         = _theApp.CreateController <UserController>();


            var result = await userCtrl.DoSettings(settingViewModel);


            ShouldBeRedirectResult(result);

            _theApp.ReloadEntity(user);
            Assert.Equal(user.UserName, user.DisplayName);
        }
コード例 #25
0
        public ActionResult PersonalCabinet(UserSettingsViewModel settingsView)
        {
            if (settingsView == null)
            {
                throw new ArgumentNullException(nameof(settingsView));
            }

            if (!ModelState.IsValid)
            {
                return(View(settingsView));
            }

            UpdateUserInfo(settingsView);

            UpdatePluginSettings(settingsView);

            return(View(settingsView));
        }
コード例 #26
0
        public async Task should_update_avatar_file_id()
        {
            var user             = _theApp.MockUser();
            var settingViewModel = new UserSettingsViewModel
            {
                AvatarFileId = 12
            };
            var userCtrl = _theApp.CreateController <UserController>();


            var result = await userCtrl.DoSettings(settingViewModel);


            ShouldBeRedirectResult(result);

            _theApp.ReloadEntity(user);
            Assert.Equal(12, user.AvatarFileId);
        }
コード例 #27
0
        public IActionResult ChangeTheme(int theme, int accent)
        {
            var themeColor = new ThemeColorViewModel();
            switch (theme)
            {
                case 0: themeColor.Color = "#fff"; themeColor.CssClass = "is-white-background"; break;
                case 1: themeColor.Color = "#333"; themeColor.CssClass = "is-dark-background"; break;

                default: themeColor.Color = "#fff"; themeColor.CssClass = "is-white-background"; break;
            }

            var accentColor = new ThemeColorViewModel();
            switch (accent)
            {
                case 0: accentColor.Color = "#FFDB4A"; accentColor.CssClass = "is-warning-accent"; break;
                case 1: accentColor.Color = "#23D160"; accentColor.CssClass = "is-success-accent"; break;
                case 2: accentColor.Color = "#276CDA"; accentColor.CssClass = "is-link-accent"; break;
                case 3: accentColor.Color = "#1496ED"; accentColor.CssClass = "is-info-accent"; break;
                case 4: accentColor.Color = "#FF2B56"; accentColor.CssClass = "is-danger-accent"; break;
                case 5: accentColor.Color = "#00C4A7"; accentColor.CssClass = "is-primary-accent"; break;

                default: accentColor.Color = "#1496ED"; accentColor.CssClass = "is-info-accent"; break;
            }

            string root = _environment.WebRootPath;
            string dir = $"{root}\\data\\settings\\{User.Identity.Name}";
            string file = $"{dir}\\config.json";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            using (var sw = System.IO.File.CreateText(file))
            {
                var serializer = new JsonSerializer();
                var userSettings = new UserSettingsViewModel() { AccentColor = accentColor, ThemeColor = themeColor };

                serializer.Serialize(sw, userSettings);
                HttpContext.Session.SetString("APP_THEME", JsonConvert.SerializeObject(userSettings));
            }

            return View();
        }
コード例 #28
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            NavigationService.Lock();

            User user;

            switch (e.Parameter)
            {
            case string uid:
                user = await RestApiService <User> .Get(new FirebaseKey(uid, typeof(User).Name));

                break;

            case FirebaseKey key:
                user = await RestApiService <User> .Get(key);

                break;

            case IFirebaseEntity databaseItem:
                user = await RestApiService <User> .Get(databaseItem.Key);

                break;

            default:
                await NotificationService.DisplayErrorMessage("Developer error.");

                throw new InvalidOperationException();
            }

            if (user == null)
            {
                await NotificationService.DisplayErrorMessage("This user does not exist.");

                NavigationService.GoBack();
            }

            ViewModel = new UserSettingsViewModel(user);

            InitializeComponent();

            NavigationService.Unlock();

            NavigationService.SetHeaderTitle($"{ViewModel.Model?.UserName} - Settings");
        }
コード例 #29
0
 public ActionResult Settings(int id = -1, UserSettingsViewModel settings = null)
 {
     if (settings == null || settings.IsFirstIn)
     {
         if (_auth.User == null)
         {
             return(HttpNotFound());
         }
         var us = Mapper.Map <User, UserViewModel>(_userService.GetById(_auth.User.Id));
         return(View(new UserSettingsViewModel()
         {
             User = us
         }));
     }
     else
     {
         return(View(settings));
     }
 }
コード例 #30
0
        public ActionResult Change_tracking_pixels(UserSettingsViewModel model)
        {
            var user = _contentManager.Get <TeeyootUserPart>(model.Id, VersionOptions.Latest);

            if (user != null)
            {
                user.DefaultFBPixelId                      = model.DefaultFBPixelId;
                user.DefaultTwitterPixelId                 = model.DefaultTwitterPixelId;
                user.DefaultPinterestPixelId               = model.DefaultPinterestPixelId;
                user.DefaultGooglePixelId                  = model.DefaultGooglePixelId;
                user.DefaultGoogleLabelPixelId             = model.DefaultGoogleLabelPixelId;
                user.DefaultGoogleAnalyticsTrackingSnippet = model.DefaultGoogleAnalyticsTrackingSnippet;
                user.DefaultFacebookCustomAudiencePixel    = model.DefaultFacebookCustomAudiencePixel;
                model.InfoMessage = T("Your Tracking Pixels has been changed sucessfully!").ToString();
                return(RedirectToAction("Profile", model));
            }

            return(RedirectToAction("Profile", model));
        }
コード例 #31
0
        public UserSettingsView(UserSettingsViewModel viewModel)
        {
            InitializeComponent();
            ViewModel = viewModel;

            this.WhenActivated(d =>
            {
                this.Bind(ViewModel, vm => vm.Config.UserAgent, v => v.UserAgentTextBox.Text).DisposeWith(d);
                this.Bind(ViewModel, vm => vm.Config.Cookie, v => v.CookieTextBox.Text).DisposeWith(d);
                this.Bind(ViewModel, vm => vm.Config.IsUseProxy, v => v.ProxySwitch.IsOn).DisposeWith(d);

                this.BindCommand(ViewModel, vm => vm.QrCodeLoginCommand, v => v.GetQrCodeButton).DisposeWith(d);
                this.BindCommand(ViewModel, vm => vm.CheckLoginCommand, v => v.CheckLoginButton).DisposeWith(d);
                this.OneWayBind(ViewModel, vm => vm.LoginStatus, v => v.LoginStatusTextBlock.Text).DisposeWith(d);
                this.OneWayBind(ViewModel, vm => vm.LoginStatusForeground, v => v.LoginStatusTextBlock.Foreground).DisposeWith(d);

                ViewModel.CheckLoginCommand.Execute().Subscribe().DisposeWith(d);
            });
        }
コード例 #32
0
		public ActionResult SetNotifications(UserSettingsViewModel userSettingsViewModel)
		{
			if (userSettingsViewModel.UserId != this.ActiveUser.UserId)
			{
				return this.Issue404();
			}

			using (var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork())
			{
				try
				{
					var user = this.UserService.GetUserById(userSettingsViewModel.UserId);

					#region Sub/Un-SUB Types

					// RecipeComments: Handle Unsubscribe
					if (!userSettingsViewModel.RecipeCommentNotifications &&
					    user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int) NotificationType.RecipeComment))
					{
						this.UserService.UnsubscribeUserFromNotificationType(user, NotificationType.RecipeComment);
					}

					// RecipeComments: Handle Subscribe
					if (userSettingsViewModel.RecipeCommentNotifications &&
					    !user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int) NotificationType.RecipeComment))
					{
						this.UserService.SubscribeUserToNotificationType(user, NotificationType.RecipeComment);
					}

					// BrewSessionComments: Handle Unsubscribe
					if (!userSettingsViewModel.BrewSessionCommentNotifications &&
						user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.BrewSessionComment))
					{
						this.UserService.UnsubscribeUserFromNotificationType(user, NotificationType.BrewSessionComment);
					}

					// BrewSessionComments: Handle Subscribe
					if (userSettingsViewModel.BrewSessionCommentNotifications &&
						!user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.BrewSessionComment))
					{
						this.UserService.SubscribeUserToNotificationType(user, NotificationType.BrewSessionComment);
					}

					// BrewerFollow: Handle Unsubscribe
					if (!userSettingsViewModel.BrewerFollowNotifications &&
						user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.BrewerFollowed))
					{
						this.UserService.UnsubscribeUserFromNotificationType(user, NotificationType.BrewerFollowed);
					}

					// BrewerFollow: Handle Subscribe
					if (userSettingsViewModel.BrewerFollowNotifications &&
						!user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.BrewerFollowed))
					{
						this.UserService.SubscribeUserToNotificationType(user, NotificationType.BrewerFollowed);
					}

					// SiteFeatures: Handle Unsubscribe
					if (!userSettingsViewModel.SiteFeatureNotifications &&
						user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.SiteFeatures))
					{
						this.UserService.UnsubscribeUserFromNotificationType(user, NotificationType.SiteFeatures);
					}

					// SiteFeatures: Handle Subscribe
					if (userSettingsViewModel.SiteFeatureNotifications &&
						!user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.SiteFeatures))
					{
						this.UserService.SubscribeUserToNotificationType(user, NotificationType.SiteFeatures);
					}

					// SiteOutages: Handle Unsubscribe
					if (!userSettingsViewModel.SiteOutageNotifications &&
						user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.SiteOutages))
					{
						this.UserService.UnsubscribeUserFromNotificationType(user, NotificationType.SiteOutages);
					}

					// SiteOutages: Handle Subscribe
					if (userSettingsViewModel.SiteOutageNotifications &&
						!user.UserNotificationTypes.Any(x => x.NotificationTypeId == (int)NotificationType.SiteOutages))
					{
						this.UserService.SubscribeUserToNotificationType(user, NotificationType.SiteOutages);
					}

					#endregion

					unitOfWork.Commit();

					return new EmptyResult();
				}
				catch (Exception ex)
				{
					unitOfWork.Rollback();
					this.LogHandledException(ex);
					return this.Issue500();
				}
			}
		}