Esempio n. 1
0
        public async Task<IActionResult> DeleteUser(string userId)
        {
            var user = await _mediator.SendAsync(new UserQuery { UserId = userId });
            var viewModel = new DeleteUserViewModel
            {
                UserId = userId,
                UserName = user.UserName,
            };

            return View(viewModel);
        }
        public async Task<IActionResult> DeleteUser(string userId)
        {
            var user = await _mediator.SendAsync(new UserQuery { UserId = userId });
            var campaigns = await _mediator.SendAsync(new CampaignByApplicationUserIdQuery() { ApplicationUserId = userId });
            var events = await _mediator.SendAsync(new EventsByApplicationUserIdQuery() { ApplicationUserId = userId });
            var tasks = await _mediator.SendAsync(new TasksByApplicationUserIdQuery() { ApplicationUserId = userId });
            
            var viewModel = new DeleteUserViewModel
            {
                UserId = userId,
                UserName = user.UserName,
                IsSiteAdmin = user.IsSiteAdmin,
                OrganizationName = user.Organization?.Name,
                IsOrganizationAdmin = user.IsOrganizationAdmin,
                Campaigns = campaigns?.Select(x => x.Name),
                Events = events?.Select(x => x.Name),
                Tasks = tasks?.Select(x => x.Name)
            };

            return View(viewModel);
        }