public async Task <IActionResult> Create([Bind("ItemTypeID,TypeName")] ItemType itemType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(itemType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(itemType));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("BrandID,BrandName")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(brand);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }
        public async Task <IActionResult> Create([Bind("BrandID,ItemTypeID")] Component component)
        {
            if (ModelState.IsValid)
            {
                _context.Add(component);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandID"]    = new SelectList(_context.Brands, "BrandID", "BrandName", component.BrandID);
            ViewData["ItemTypeID"] = new SelectList(_context.ItemTypes, "ItemTypeID", "TypeName", component.ItemTypeID);
            return(View(component));
        }