Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("SupplierId,SupplierName,SupplierAbbr,SupplierClassify,SupplierCompetentProducts,SupplierBuyer,SupplierProvince,SupplierCity,SupplierAddress,SupplierEnable")] Supplier supplier)
        {
            if (id != supplier.SupplierId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supplier);
                    if (await _context.SaveChangesAsync() > 0)
                    {
                        ViewData["SumbitMessge"] = "保存成功!";
                    }
                    ;
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupplierExists(supplier.SupplierId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                // return RedirectToAction(nameof(Index));
            }
            return(View(supplier));
        }