예제 #1
0
        public IActionResult Edit(int id, [Bind("VendorID,Name,Phone,LoginName,LoginPassword,Comment")] Vendor vendor)
        {
            if (id != vendor.VendorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    vendorRepo.EditVendor(vendor);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VendorExists(vendor.VendorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendor));
        }