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

            Brand = await _context.Brands.FirstOrDefaultAsync(m => m.Id == id);

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

            Brand = await _brandService.GetBrandById(id);

            if (Brand == null)
            {
                return(NotFound());
            }
            ViewData["BrandImage"] = Brand.Logo ?? "no-image.png";
            return(Page());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Brand = await _context.Brands.FindAsync(id);

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

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