예제 #1
0
        public async Task <IActionResult> Create([Bind("VendorID,Name,Status,Phone,Email")] 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("ProductID,Description,QtyonHand,ReorderPoint,Status,Cost,Price,VendorID")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendorID"] = new SelectList(_context.Vendor, "VendorID", "Name", product.VendorID);
            return(View(product));
        }