public async Task <IActionResult> Edit(int id, [Bind("Name,Id")] Brand brand) { if (id != brand.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(brand); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(brand.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(brand)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,DepartmentID,BrandID,LinkID,RefId,IsVisible,IsActive,ShowWithoutStock,Description,DescriptionShort,ReleaseDate,KeyWords,Title,MetaTagDescription,Id")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.Id)) { return(NotFound()); } else { throw; } } 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)); }