Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Film = await _context.Film
                   .Include(f => f.Category)
                   .Include(f => f.Director)
                   .Include(f => f.Native).FirstOrDefaultAsync(m => m.ID == id);

            if (Film == null)
            {
                return(NotFound());
            }
            return(Page());
        }