コード例 #1
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

            if (TblOnlineProduct == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #2
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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