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

            CategoryOfJewelry = await _context.CategoryOfJewelry
                                .Include(c => c.Jewelry).FirstOrDefaultAsync(m => m.Id == id);

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

            CategoryOfJewelry = await _context.CategoryOfJewelry
                                .Include(c => c.Jewelry).FirstOrDefaultAsync(m => m.Id == id);

            if (CategoryOfJewelry == null)
            {
                return(NotFound());
            }
            ViewData["JewelryId"] = new SelectList(_context.Jewelry, "Id", "Id");
            return(Page());
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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