Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,UserId,OrderDate,ShippedDate,ShippingAddress,ShippingMethod,OrderStatus,Comments")] Orders orders)
        {
            if (id != orders.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Address1", orders.UserId);
            return(View(orders));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("PromoId,DiscountValue")] Promotions promotions)
        {
            if (id != promotions.PromoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(promotions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PromotionsExists(promotions.PromoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(promotions));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,ProductId,OrderCost,Quantity,PromoId")] OrderDetails tOrderDetails)
        {
            if (id != tOrderDetails.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tOrderDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TOrderDetailsExists(tOrderDetails.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.TProducts, "ProductId", "ProductName", tOrderDetails.ProductId);
            ViewData["PromoId"]   = new SelectList(_context.TPromotions, "PromoId", "PromoId", tOrderDetails.PromoId);
            return(View(tOrderDetails));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Pass,FirstName,LastName,UserType,Email,PhoneNumber,Company,Address1,City,PostalCode")] Users users)
        {
            if (id != users.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("CardId,CardNumber,NameOnCard,ExpirationDate,Cvv")] Cards cards)
        {
            if (id != cards.CardId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cards);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CardsExists(cards.CardId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cards));
        }
Пример #6
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,CategoryId,ProductName,Price,ImageColumn,ProductDescription")] Products tProducts)
        {
            if (id != tProducts.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tProducts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TProductsExists(tProducts.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.TCategories, "CategoryId", "CategoryName", tProducts.CategoryId);
            return(View(tProducts));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName,CategoryDescription")] Categories categories)
        {
            if (id != categories.CategoryId)
            {
                return(NotFound());
            }

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