public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Company,Message,DatePublished,Publish")] TestimonyModel testimonyModel) { if (id != testimonyModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(testimonyModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestimonyModelExists(testimonyModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(testimonyModel)); }
public async Task <IActionResult> Testimonials([Bind("Id,Name,Company,Message,DatePublished,Publish")] TestimonyModel testimonyModel) { if (ModelState.IsValid) { _context.Add(testimonyModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Thanks))); } return(View(testimonyModel)); }