public async Task <IActionResult> Edit(int id, [Bind("Id,ProductSettingId,Title, ImageSource")] ProductAlliance productAlliance) { if (id != productAlliance.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productAlliance); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductAllianceExists(productAlliance.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductSettingId"] = new SelectList(_context.ProductSetting, "Id", "Title", productAlliance.ProductSettingId); return(View(productAlliance)); }
public async Task <IActionResult> Create([Bind("Id,ProductSettingId,Title, ImageSource")] ProductAlliance productAlliance) { if (ModelState.IsValid) { _context.Add(productAlliance); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductSettingId"] = new SelectList(_context.ProductSetting, "Id", "Title", productAlliance.ProductSettingId); return(View(productAlliance)); }