public async Task <IActionResult> Create([Bind("Id,VendorName,VendorWebstore")] Vendor vendor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendor));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,StoreFrontName,StoreFrontUrl")] StoreFront storeFront)
        {
            if (ModelState.IsValid)
            {
                _context.Add(storeFront);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(storeFront));
        }
        public async Task <IActionResult> Create([Bind("Id,VendorId,UnitPrice,Name")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendorId"] = new SelectList(_context.Set <Vendor>(), "Id", "Id", product.VendorId);
            return(View(product));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,ProductId,StoreFrontId,Quantity")] Revenue revenue)
        {
            if (ModelState.IsValid)
            {
                _context.Add(revenue);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"]    = new SelectList(_context.Product, "Id", "Id", revenue.ProductId);
            ViewData["StoreFrontId"] = new SelectList(_context.Set <StoreFront>(), "Id", "Id", revenue.StoreFrontId);
            return(View(revenue));
        }