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

            Customer = await _context.Customer
                       .Include(c => c.Employee)
                       .Include(c => c.Flower).FirstOrDefaultAsync(m => m.ID == id);

            if (Customer == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #2
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);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Customer = await _context.Customer
                       .Include(c => c.Employee)
                       .Include(c => c.Flower).FirstOrDefaultAsync(m => m.ID == id);

            if (Customer == null)
            {
                return(NotFound());
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employee, "ID", "Name");
            ViewData["FlowerID"]   = new SelectList(_context.Flower, "ID", "Name");
            return(Page());
        }