public async Task <IActionResult> Index(ManageNotificationsViewModel model) { var notification = new Notification { Title = model.Title, Description = model.Description, Enabled = model.Enabled }; await _notificationService.SetNotification(notification); TempData.Put("model", new { Message = "Notification banner updated!" }); return(RedirectToAction(nameof(AdminController.AdminActionComplete), typeof(AdminController))); }
public async Task <IActionResult> Index() { var currentNotification = await _notificationService.GetNotification(); var model = new ManageNotificationsViewModel(); if (currentNotification != null) { model.Title = currentNotification.Title; model.Description = currentNotification.Description; model.Enabled = currentNotification.Enabled; } return(View(model)); }
public ActionResult Notifications(string message) { ViewBag.StatusMessage = message; string userId = User.Identity.GetUserId(); ApplicationUser authedUser = UserManager.FindById(userId); IEnumerable <IPlayerMessage> notifications = authedUser.GameAccount.Config.Notifications; ManageNotificationsViewModel model = new ManageNotificationsViewModel(notifications) { AuthedUser = authedUser }; return(View(model)); }
public async Task <ActionResult> Notifications() { await SetNotificationsAsync(); var currentUserId = User.Identity.GetUserId(); var emailNotifications = await UserService.GetEmailNotificationsForUserAsync(currentUserId); ManageNotificationsViewModel viewModel = Mapper.Map <EmailNotifications, ManageNotificationsViewModel>(emailNotifications); if (TempData["StatusMessage"] != null) { ViewBag.StatusMessage = TempData["StatusMessage"].ToString(); } return(View(viewModel)); }
public async Task <ActionResult> Notifications(ManageNotificationsViewModel viewModel) { await SetNotificationsAsync(); if (ModelState.IsValid) { var currentUserId = User.Identity.GetUserId(); await UserService.SaveEmailNotificationChangesAsync(currentUserId, viewModel.SendGiftNotifications, viewModel.SendMessageNotifications, viewModel.SendNewFollowerNotifications, viewModel.SendTagNotifications, viewModel.SendReviewNotifications); TempData["StatusMessage"] = "Your notifications have been changed."; } return(RedirectToAction("notifications")); }