public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,CardIdNumber,CardName,ExpiryDate,SecurityCode")] Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdOrder,IdShose")] OrderShoe orderShoe)
        {
            if (id != orderShoe.IdShose)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderShoe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderShoeExists(orderShoe.IdShose))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdOrder"] = new SelectList(_context.Order, "Id", "CardName", orderShoe.IdOrder);
            ViewData["IdShose"] = new SelectList(_context.Shoe, "Id", "Color", orderShoe.IdShose);
            return(View(orderShoe));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,City,Country,Street,HouseNumber,Mail,Password,Order")] 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));
        }
        // GET: Shoes/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var shoe = await _context.Shoe
                       .FirstOrDefaultAsync(m => m.Id == id);

            if (shoe == null)
            {
                return(NotFound());
            }
            shoe.Views++;
            _context.Update(shoe);
            await _context.SaveChangesAsync();

            return(View(shoe));
        }