public async Task <IActionResult> Edit(int id, [Bind("ID,dateRan,slug,summary,byline,link,lean")] Story story) { if (id != story.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(story); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoryExists(story.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(story)); }
public async Task <IActionResult> Create([Bind("ID,dateRan,slug,summary,byline,link,lean,topic")] Story story) { if (ModelState.IsValid) { _context.Add(story); await _context.SaveChangesAsync(); //_context.Add(Topics); return(RedirectToAction(nameof(Index))); } return(View(story)); }