public async Task <IActionResult> Edit(int id, [Bind("ProductsId,Name,Description")] Product product)
        {
            if (id != product.ProductsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.ProductsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrdersId,CustomerId,OrderDate,FreightCharge,TotalDue")] Order order)
        {
            if (id != order.OrdersId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrdersId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "FirstName", order.CustomerId);
            return(View(order));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,Address,Zipcode,PhoneNumber,Extension")] Customers customers)
        {
            if (id != customers.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomersExists(customers.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Zipcode"] = new SelectList(_context.Zip, "Zipcode", "Zipcode", customers.Zipcode);
            return(View(customers));
        }
示例#4
0
        public async Task <IActionResult> Edit(string id, [Bind("Zipcode,City,State")] Zip zip)
        {
            if (id != zip.Zipcode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(zip);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ZipExists(zip.Zipcode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(zip));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CustomerId,PmtDate,Amt")] Payment payment)
        {
            if (id != payment.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentExists(payment.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "FirstName", payment.CustomerId);
            return(View(payment));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("OrdersId,ProductsId,Quantity,UnitPrice,LineItemTotal,ShipDate")] ItemsonOrder itemsonOrder)
        {
            if (id != itemsonOrder.OrdersId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(itemsonOrder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemsonOrderExists(itemsonOrder.OrdersId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrdersId"]   = new SelectList(_context.Orders, "OrdersId", "OrdersId", itemsonOrder.OrdersId);
            ViewData["ProductsId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", itemsonOrder.ProductsId);
            return(View(itemsonOrder));
        }