コード例 #1
0
        public async Task <IActionResult> Create([Bind("StoreId,StoreName,StoreLocation")] NuggetStores nuggetStores)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nuggetStores);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nuggetStores));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,PreferredStore")] Customers customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(Redirect("/"));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ProductId,ProductName,ProductPrice,Inventory")] Products products)
        {
            if (ModelState.IsValid)
            {
                _context.Add(products);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(products));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("LogId,OrderId,ProductId,ProductQty,SubTotal")] OrderLog orderLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"]   = new SelectList(_context.Orders, "OrderId", "OrderId", orderLog.OrderId);
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductId", orderLog.ProductId);
            return(View(orderLog));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("OrderId,DateTimeStamp,StoreId,CustomerId,Total")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orders);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Orders, "CustomerId", "CustomerId", orders.CustomerId);
            ViewData["StoreId"]    = new SelectList(_context.Orders, "StoreId", "StoreId", orders.StoreId);
            return(View(orders));
        }