public async Task <IActionResult> OnGetAsync(int id)
        {
            Modulhandbuch = await Context.Modulhandbuch.FirstOrDefaultAsync(m => m.ModulhandbuchId == id);

            if (Modulhandbuch == null)
            {
                return(NotFound());
            }
            //  var isA =
            //                             User.IsInRole(Constants.DekanRole);

            // var iA =
            ///                    User.IsInRole(Constants.DozentRole);
            //  var i =
            //                    User.IsInRole(Constants.AdminRole);
//
            //  var currentUserId = UserManager.GetUserId(User);

            //  if (!isA || !iA || !i
            // /*  && Änderung.Status != ÄndernStatus.Approved*/)
            //{
            //    return Forbid();
            // }

            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Modulhandbuch = await _context.Modulhandbuch.FirstOrDefaultAsync(m => m.ModulhandbuchId == id);

            if (Modulhandbuch == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Modulhandbuch = await _context.Modulhandbuch.FindAsync(id);

            if (Modulhandbuch != null)
            {
                _context.Modulhandbuch.Remove(Modulhandbuch);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnGetAsync(int id)
        {
            Modulhandbuch = await Context.Modulhandbuch.FirstOrDefaultAsync(
                m => m.ModulhandbuchId == id);

            if (Modulhandbuch == null)
            {
                return(NotFound());
            }

            var isAuthorized = await AuthorizationService.AuthorizeAsync(
                User, Modulhandbuch,
                ContactOperations.Delete);

            if (!isAuthorized.Succeeded)
            {
                return(Forbid());
            }

            return(Page());
        }