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

            CarSale = await _context.CarSale
                      .Include(c => c.Customers)
                      .Include(c => c.SalePersons).FirstOrDefaultAsync(m => m.CarSaleId == id);

            if (CarSale == null)
            {
                return(NotFound());
            }
            ViewData["CustomerId"]   = new SelectList(_context.Set <Customer>(), "CustomerId", "CustomerId");
            ViewData["SalePersonId"] = new SelectList(_context.Set <SalePerson>(), "SalePersonId", "SalePersonId");
            return(Page());
        }
示例#2
0
 public IActionResult OnGet()
 {
     ViewData["CustomerId"]   = new SelectList(_context.Set <Customer>(), "CustomerId", "CustomerId");
     ViewData["SalePersonId"] = new SelectList(_context.Set <SalePerson>(), "SalePersonId", "SalePersonId");
     return(Page());
 }