public async Task <IActionResult> Create([Bind("ColorID,ColorName,Price,ColorFamID,ColorFamName")] Color color)
        {
            if (ModelState.IsValid)
            {
                _context.Add(color);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(color));
        }
        public async Task <IActionResult> Create([Bind("ID,LastName,FirstMidName,OrderDate")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ChemID,ChemComp,ChemAbbrev,ColorID,WarehouseLocationID")] Chem chem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chem));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("OrderID,ColorID,CustomerID")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ColorID"]    = new SelectList(_context.Set <Color>(), "ColorID", "ColorID", order.ColorID);
            ViewData["CustomerID"] = new SelectList(_context.Customer, "ID", "FirstMidName", order.CustomerID);
            return(View(order));
        }