public async Task <IActionResult> Edit(int id, [Bind("ArticleNirSpecialId,ArticleId,NirSpecialId")] ArticleNirSpecial articleNirSpecial) { if (id != articleNirSpecial.ArticleNirSpecialId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(articleNirSpecial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleNirSpecialExists(articleNirSpecial.ArticleNirSpecialId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ArticleId"] = new SelectList(_context.Articles, "ArticleId", "ArticleName", articleNirSpecial.ArticleId); ViewData["NirSpecialId"] = new SelectList(_context.NirSpecials, "NirSpecialId", "NirSpecialName", articleNirSpecial.NirSpecialId); return(View(articleNirSpecial)); }
public async Task <IActionResult> Create([Bind("ArticleNirSpecialId,ArticleId,NirSpecialId")] ArticleNirSpecial articleNirSpecial) { if (ModelState.IsValid) { _context.Add(articleNirSpecial); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArticleId"] = new SelectList(_context.Articles, "ArticleId", "ArticleName", articleNirSpecial.ArticleId); ViewData["NirSpecialId"] = new SelectList(_context.NirSpecials, "NirSpecialId", "NirSpecialName", articleNirSpecial.NirSpecialId); return(View(articleNirSpecial)); }