예제 #1
0
        public async Task <IActionResult> Create([Bind("ProductId,Title,Genre,Release,Price,Quantity")] Games games)
        {
            if (ModelState.IsValid)
            {
                _context.Add(games);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(games));
        }
        public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,Phone,Email,Street,City,State,ZipCode,Password,UserName")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("StoreId,StoreName,Phone,Email,Street,City,State,ZipCode")] Locations locations)
        {
            if (ModelState.IsValid)
            {
                _context.Add(locations);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(locations));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("InventoryId,StoreId,ProductId,Quantity,Title")] Inventory inventory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inventory);
                await _context.SaveChangesAsync();

                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));
        }
예제 #5
0
        public async Task <IActionResult> Create([Bind("ProductId,OrderId,Quantity,OrderlineId")] Orderline orderline)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderline);
                await _context.SaveChangesAsync();

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