public virtual async Task <ActionResult> ChangeEmailSubscription(bool subscribe) { var user = GetCurrentUser(); if (user == null) { return(HttpNotFound()); } await UserService.ChangeEmailSubscriptionAsync(user, subscribe); TempData["Message"] = Strings.EmailPreferencesUpdated; return(RedirectToAction("Account")); }
public virtual async Task <ActionResult> ChangeEmailSubscription(bool?emailAllowed, bool?notifyPackagePushed) { var user = GetCurrentUser(); if (user == null) { return(HttpNotFound()); } await UserService.ChangeEmailSubscriptionAsync(user, emailAllowed.HasValue&& emailAllowed.Value, notifyPackagePushed.HasValue&& notifyPackagePushed.Value); TempData["Message"] = Strings.EmailPreferencesUpdated; return(RedirectToAction("Account")); }
public virtual async Task <ActionResult> ChangeEmailSubscription(TAccountViewModel model) { var account = GetAccount(model.AccountName); if (account == null || ActionsRequiringPermissions.ManageAccount.CheckPermissions(GetCurrentUser(), account) != PermissionsCheckResult.Allowed) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, Strings.Unauthorized)); } await UserService.ChangeEmailSubscriptionAsync( account, model.ChangeNotifications.EmailAllowed, model.ChangeNotifications.NotifyPackagePushed); TempData["Message"] = Messages.EmailPreferencesUpdated; return(RedirectToAction(AccountAction)); }