public async Task <IActionResult> Edit(int id, [Bind("Name,Storenum")] Location location)
        {
            if (id != location.Storenum)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.Storenum))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
示例#2
0
        public async Task <IActionResult> Edit(string id, [Bind("Name,Address,Storenum,Phone")] Customer customer)
        {
            if (id != customer.Name)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Name))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Storenum"] = new SelectList(_context.Location, "Storenum", "Name", customer.Storenum);
            return(View(customer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Name,Ordernum,Ordertime")] FoodOrder foodOrder)
        {
            if (id != foodOrder.Ordernum)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(foodOrder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FoodOrderExists(foodOrder.Ordernum))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Name"] = new SelectList(_context.Customer, "Name", "Name", foodOrder.Name);
            return(View(foodOrder));
        }