예제 #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Cnpj,Address,PostCode,Phone,Email")]
                                               Supplier supplier)
        {
            if (id != supplier.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supplier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_context.SupplierExists(supplier.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(supplier));
        }