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

            candies = await _context.candies
                      .Include(c => c.Candyshop).FirstOrDefaultAsync(m => m.CID == id);

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

            candies = await _context.candies
                      .Include(c => c.Candyshop).FirstOrDefaultAsync(m => m.CID == id);

            if (candies == null)
            {
                return(NotFound());
            }
            ViewData["CSID"] = new SelectList(_context.Set <Cshop>(), "CSID", "CSID");
            return(Page());
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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