public PartialViewResult _Submit(Comment comment) { ctx.Comments.Add(comment); ctx.SaveChanges(); List<Comment> Comments = ctx.Comments .Where(c => c.SessionId == comment.SessionId).ToList(); ViewBag.SessionId = comment.SessionId; return PartialView("_GetForSession", Comments); }
public PartialViewResult _Submit(Comment comment) { context.Comments.Add(comment); context.SaveChanges(); List<Comment> comments = context.Comments.Where(x => x.SessionID == comment.SessionID).ToList(); ViewBag.SessionID = comment.SessionID; return PartialView("_GetForSession", comments); }
public void AddComment(int sessionid, string content) { using (var ctx = new ConferenceContext()) { Comment comment = new Comment { SessionId = sessionid, Content = content }; ctx.Comments.Add(comment); ctx.SaveChanges(); Clients.Group(sessionid.ToString()).AddNewComment(content); } }
public PartialViewResult _Submit(Comment comment) { //no validation, just add db.Comments.Add(comment); db.SaveChanges(); //refresh comment list List<Comment> comments = db.Comments.Where(c => c.SessionID == comment.SessionID).ToList(); ViewBag.SessionID = comment.SessionID; return PartialView("_GetForSession", comments); }
public PartialViewResult _CommentForm(Int32 sessionID) { Comment comment = new Comment() { SessionID = sessionID }; return PartialView("_CommentForm", comment); }
public PartialViewResult _CommentForm(int sessionId) { Comment comment = new Comment { SessionId = sessionId }; return PartialView("_CommentForm", comment); }