示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CustomerId,OrderDate,DeliveryDate,Address1,PostalCode,Total,Weight,PaymentType,Details,SpecialInstructions,Status,DriverId")] Order order)
        {
            if (id != order.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(order));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,UserName,Password,StartDate,RegistrationDate,Address1,City,Province,PostalCode,PhoneNumber,SpecialInstructions,Status,Photo")] Customer customer)
        {
            if (id != customer.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }