Ejemplo n.º 1
0
        public async Task<IActionResult> OnGetAsync(long? id)
        {
            if (id == null)
            {
                return NotFound();
            }

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

            if (CarsBrands == null)
            {
                return NotFound();
            }
            return Page();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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