public async Task <IActionResult> Create([Bind("Name,Storenum")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Name,Address,Storenum,Phone")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Storenum"] = new SelectList(_context.Location, "Storenum", "Name", customer.Storenum);
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("Name,Ordernum,Ordertime")] FoodOrder foodOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(foodOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Name"] = new SelectList(_context.Customer, "Name", "Name", foodOrder.Name);
            return(View(foodOrder));
        }