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

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

            if (Customer != null)
            {
                _context.Customer.Remove(Customer);//delete customer
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Customer = await _context.Customer
                       .Include(c => c.RateList)
                       .Include(c => c.Wine).SingleOrDefaultAsync(m => m.ID == id);

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

            Customer = await _context.Customer
                       .Include(c => c.RateList)
                       .Include(c => c.Wine).SingleOrDefaultAsync(m => m.ID == id);

            if (Customer == null)
            {
                return(NotFound());
            }
            ViewData["RateListID"] = new SelectList(_context.RateList, "ID", "Price"); //rate dropdown
            ViewData["WineID"]     = new SelectList(_context.Wines, "ID", "Name");     //wine dropdown
            return(Page());
        }