Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("productId,productName,productQty,productPrice,createdDate")] 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)));
            }
            return(View(product));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("checkoutId,checkoutLicensePlate,checkoutTime")] CarCheckOut carCheckOut)
        {
            if (id != carCheckOut.checkoutId)
            {
                return(NotFound());
            }

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