public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,Phone,Email,Street,City,State,ZipCode,Password,UserName")] Customer customer)
        {
            if (id != customer.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public IActionResult Edit(int id, [Bind("ProductId,Title,Genre,Release,Price,Quantity")] Games games)
        {
            if (id != games.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(games);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GamesExists(games.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(games));
        }
        public IActionResult Edit(int id, [Bind("CustomerId,FirstName,LastName,Phone,Email,Street,City,State,ZipCode,Password,UserName")] Customer customer)
        {
            if (id != customer.CustomerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ctx.Update(customer);
                    ctx.SaveChanges();
                }
                catch (Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 4
0
        public IActionResult Edit(int id, [Bind("ProductId,OrderId,Quantity,OrderlineId")] Orderline orderline)
        {
            if (id != orderline.OrderlineId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderline);
                    _context.SaveChanges();
                }
                catch (Exception)
                {
                    if (!OrderlineExists(orderline.OrderlineId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"]   = new SelectList(_context.Orders, "OrderId", "OrderId", orderline.OrderId);
            ViewData["ProductId"] = new SelectList(_context.Games, "ProductId", "Title", orderline.ProductId);
            return(View(orderline));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("InventoryId,StoreId,ProductId,Quantity,Title")] Inventory inventory)
        {
            if (id != inventory.InventoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inventory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InventoryExists(inventory.InventoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Games, "ProductId", "Title", inventory.ProductId);
            ViewData["StoreId"]   = new SelectList(_context.Locations, "StoreId", "StoreName", inventory.StoreId);
            return(View(inventory));
        }
Exemplo n.º 6
0
        public IActionResult Edit(int id, [Bind("StoreId,StoreName,Phone,Email,Street,City,State,ZipCode")] Locations locations)
        {
            if (id != locations.StoreId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ctx.Update(locations);
                    ctx.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationsExists(locations.StoreId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(locations));
        }
Exemplo n.º 7
0
        public IActionResult Edit(int id, [Bind("OrderId,StoreId,CustomerId,Time,Checkout")] Orders orders)
        {
            if (id != orders.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "FirstName", orders.CustomerId);
            ViewData["StoreId"]    = new SelectList(_context.Locations, "StoreId", "StoreName", orders.StoreId);
            return(View(orders));
        }