public async Task <ActionResult> TestNotification(TestNotificationVm inputDto) { if (inputDto.Message.IsNullOrEmpty()) { inputDto.Message = "This is a test notification, created at " + DateTime.Now; } await _testNotifier.SendMessageAsync( inputDto.UserId, inputDto.Message, inputDto.Severity.ToPascalCase().ToEnum <NotificationSeverity>() ); return(RedirectToAction("Index")); }
public IViewComponentResult Invoke() { var onlineUserIds = _onlineClientManager.GetAllClients().Select(o => o.UserId.Value).ToList(); var users = _userRepository.Query().Where(u => onlineUserIds.Contains(u.Id)).Select(u => new SelectListItem { Text = u.UserName, Value = u.Id.ToString() }).ToList(); var vm = new TestNotificationVm { OnlineUsers = users }; return(View(this.GetViewPath(), vm)); }