Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("PartId,Name,Supplier")] Part part)
        {
            if (ModelState.IsValid)
            {
                _context.Add(part);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(part));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ProductId,Name,Description")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("BomId,Quantity,PartId,ProductId")] Bom bom)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bom);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartId"]    = new SelectList(_context.Part, "PartId", "Name", bom.PartId);
            ViewData["ProductId"] = new SelectList(_context.Product, "ProductId", "Name", bom.ProductId);
            return(View(bom));
        }