Example #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Jewellery = await _context.Jewelleries.SingleOrDefaultAsync(m => m.ID == id);

            if (Jewellery == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Jewellery = await _context.Jewelleries.FindAsync(id);

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

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