Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (!User.IsInRole(Constants.Bookkeeper) && !User.IsInRole(Constants.Administrator))
            {
                return(NotFound());
            }

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

            Theatres = await Context.Theatres.FirstOrDefaultAsync(m => m.Id == id);

            if (Theatres == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (!User.IsInRole(Constants.Bookkeeper) && !User.IsInRole(Constants.Administrator))
            {
                return(NotFound());
            }

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

            Theatres = await Context.Theatres.FindAsync(id);

            if (Theatres != null)
            {
                Context.Theatres.Remove(Theatres);
                await Context.SaveChangesAsync();
            }

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