public async Task <IActionResult> Edit(int id, [Bind("ColorID,ColorName,Price,ColorFamID,ColorFamName")] Color color)
        {
            if (id != color.ColorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(color);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColorExists(color.ColorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(color));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderID,ColorID,CustomerID")] Order order)
        {
            if (id != order.OrderID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ColorID"]    = new SelectList(_context.Set <Color>(), "ColorID", "ColorID", order.ColorID);
            ViewData["CustomerID"] = new SelectList(_context.Customer, "ID", "FirstMidName", order.CustomerID);
            return(View(order));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstMidName,OrderDate")] Customer customer)
        {
            if (id != customer.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ChemID,ChemComp,ChemAbbrev,ColorID,WarehouseLocationID")] Chem chem)
        {
            if (id != chem.ChemID)
            {
                return(NotFound());
            }

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