Example #1
0
        public async Task <IActionResult> Create([Bind("Name,Id")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(brand);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(brand));
        }
        public async Task <IActionResult> Create([Bind("Name,DepartmentID,BrandID,LinkID,RefId,IsVisible,IsActive,ShowWithoutStock,Description,DescriptionShort,ReleaseDate,KeyWords,Title,MetaTagDescription,Id")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandID"]      = new SelectList(_context.Brand, "Id", "Name", product.BrandID);
            ViewData["DepartmentID"] = new SelectList(_context.Department, "Id", "Name", product.DepartmentID);
            return(View(product));
        }