public async Task <IActionResult> Edit(int id, [Bind("Id,No,Name,Weight,IsNew,IsHot,IsCommend,CreateTime,CreateUserId,CheckTime,CheckUserId,IsShow,IsDel,TypeId,BrandId,Keywords,Sales,Description,PackageList,Feature,Color,Size")] BbsProduct bbsProduct) { if (id != bbsProduct.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bbsProduct); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BbsProductExists(bbsProduct.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.BbsBrand, "Id", "Id", bbsProduct.BrandId); ViewData["TypeId"] = new SelectList(_context.BbsType, "Id", "Id", bbsProduct.TypeId); return(View(bbsProduct)); }
public async Task <IActionResult> Create([Bind("Id,No,Name,Weight,IsNew,IsHot,IsCommend,CreateTime,CreateUserId,CheckTime,CheckUserId,IsShow,IsDel,TypeId,BrandId,Keywords,Sales,Description,PackageList,Feature,Color,Size")] BbsProduct bbsProduct) { if (ModelState.IsValid) { _context.Add(bbsProduct); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.BbsBrand, "Id", "Id", bbsProduct.BrandId); ViewData["TypeId"] = new SelectList(_context.BbsType, "Id", "Id", bbsProduct.TypeId); return(View(bbsProduct)); }