public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Description,Code,Language")] snip snip) { if (id != snip.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(snip); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!snipExists(snip.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(snip)); }
public async Task <IActionResult> Create([Bind("ID,Title,Description,Code,Language")] snip snip) { if (ModelState.IsValid) { _context.Add(snip); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(snip)); }