Пример #1
0
        public async Task <IActionResult> Create([Bind("UserId,Pass,FirstName,LastName,UserType,Email,PhoneNumber,Company,Address1,City,PostalCode")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("PromoId,DiscountValue")] Promotions promotions)
        {
            if (ModelState.IsValid)
            {
                _context.Add(promotions);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(promotions));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("CardId,CardNumber,NameOnCard,ExpirationDate,Cvv")] Cards cards)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cards);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cards));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName,CategoryDescription")] Categories categories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
Пример #5
0
        public async Task <IActionResult> Create([Bind("OrderId,UserId,OrderDate,ShippedDate,ShippingAddress,ShippingMethod,OrderStatus,Comments")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Address1", orders.UserId);
            return(View(orders));
        }
Пример #6
0
        public async Task <IActionResult> Create([Bind("ProductId,CategoryId,ProductName,Price,ImageColumn,ProductDescription")] Products tProducts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tProducts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.TCategories, "CategoryId", "CategoryName", tProducts.CategoryId);
            return(View(tProducts));
        }
        public async Task <IActionResult> Create([Bind("OrderId,ProductId,OrderCost,Quantity,PromoId")] OrderDetails tOrderDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tOrderDetails);
                await _context.SaveChangesAsync();

                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));
        }