Exemplo n.º 1
0
        public async Task <IActionResult> MakeModerator(string id)
        {
            var user = this.userService.GetUserById(id);

            if (user == null)
            {
                return(base.ErrorPage());
            }

            await this.userManager.AddToRoleAsync(user, "Moderator");

            await userManager.UpdateSecurityStampAsync(user);

            await context.SaveChangesAsync();

            return(RedirectToAction("All", "Users",
                                    new { message = SUCCESS_PROMOTED_MESSAGE }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            var userId = this.userManager.GetUserId(HttpContext.User);

            this.Report.UserId = userId;
            _context.Reports.Add(Report);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }