Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductID,Description,QtyonHand,ReorderPoint,Status,Cost,Price,VendorID")] Product product)
        {
            if (id != product.ProductID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.ProductID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendorID"] = new SelectList(_context.Vendor, "VendorID", "Name", product.VendorID);
            return(View(product));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("VendorID,Name,Status,Phone,Email")] Vendor vendor)
        {
            if (id != vendor.VendorID)
            {
                return(NotFound());
            }

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