Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CustID,FirstName,LastName,Address,Email,Password")] Customer customer)
        {
            if (id != customer.CustID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 2
0
 public async Task<bool> UpdatePizza(Pizza pizza)
 {
     _context.Update(pizza);
     await _context.SaveChangesAsync();
     return true;
 }