예제 #1
0
        public async Task <IActionResult> OnGetAsync(int?id, [FromServices] UserManager <User> userManager)
        {
            User = await userManager.GetUserAsync(HttpContext.User);

            if (User == null || !User.Admin)
            {
                return(BadRequest());
            }
            if (id == null)
            {
                return(NotFound());
            }

            CompetitionDto = _competitionService.GetCompetition(id);

            if (CompetitionDto != null)
            {
                _competitionService.Delete(CompetitionDto);
            }

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