Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Publicare = await _context.Publicare.FirstOrDefaultAsync(m => m.ID == id);

            if (Publicare == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Publicare = await _context.Publicare.FirstOrDefaultAsync(m => m.ID == id);

            if (Publicare == null)
            {
                return(NotFound());
            }
            ViewData["PublicareID"] = new SelectList(_context.Set <Publicare>(), "ID", "NumelePublicarii");
            return(Page());
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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