public ActionResult Persistir(Comentario c) { using (SimpleFormContext context = new SimpleFormContext()) { context.Comentarios.Add(c); context.SaveChanges(); } return(RedirectToAction("Lista", "Home")); }
public ActionResult Lista() { ICollection <Comentario> lista = new List <Comentario>(); using (SimpleFormContext context = new SimpleFormContext()) { foreach (Comentario c in context.Comentarios) { lista.Add(c); } } return(View(lista)); }