public ActionResult AddComment(DetailThread _detailThread) { using (FakebookContext Fk = new FakebookContext()) { _detailThread.Comment.IdThread = _detailThread.Thread.Id; Fk.Comments.Add(_detailThread.Comment); Fk.SaveChanges(); return(RedirectToAction("Detail", "Thread", new{ _id = _detailThread.Thread.Id })); } }
public ActionResult Detail(int _id) { //consultamos en base al Id using (FakebookContext Fk = new FakebookContext()) { Thread threadConsultado = Fk.Threads.First(x => x.Id == _id); Comment comment = new Comment(); DetailThread detail = new DetailThread ( Fk.Categories.ToList() , Fk.Comments.Where(x => x.IdThread == _id).ToList() , threadConsultado , comment ); return(View(detail)); } }