public ActionResult AddComment(string Id, int ItemId,string comment) { DataRepository helper = new DataRepository(); string commentLeaver = ""; if (Session["Username"] == null) { ViewData["Alert"] = "Please sign in to leave a comment"; Item itemB = helper.getItem(ItemId); IList<ItemComment> commentsB = helper.getComments(ItemId); IList<Link> linksB = helper.getLinks(ItemId); DiscussionViewModel modelB = new DiscussionViewModel(ItemId, commentsB, linksB,"", "", itemB, "", "","",""); return PartialView(modelB); } else commentLeaver = Session["Username"].ToString(); helper.AddComment(commentLeaver, ItemId, comment); Item item = helper.getItem(ItemId); IList<ItemComment> comments = helper.getComments(ItemId); IList<Link> links = helper.getLinks(ItemId); DiscussionViewModel model = new DiscussionViewModel(ItemId, comments, links,"", "", item, "", "","",""); return PartialView(model); }
public ActionResult AllLinks(int ItemId) { DataRepository helper = new DataRepository(); IList<Link> links = helper.getLinks(ItemId); Item item = helper.getItem(ItemId); DiscussionViewModel model = new DiscussionViewModel(ItemId,null, links, "", "", item, "", "", "", ""); return PartialView(model); }
public ActionResult AddLink(string Id,int ItemId) { if (Session["Username"] != null) { DataRepository helper = new DataRepository(); Item item = helper.getItem(ItemId); DiscussionViewModel model = new DiscussionViewModel(ItemId, null, null, "", "", item, "", "", "", ""); return PartialView(model); } else { return PartialView("LoginAlert"); } }
public ActionResult LikeComment(string Id, int ItemId) { DataRepository helper = new DataRepository(); helper.LikeComment(Id); Item item = helper.getItem(ItemId); IList<ItemComment> comments = helper.getComments(ItemId); IList<Link> links = helper.getLinks(ItemId); DiscussionViewModel model = new DiscussionViewModel(ItemId, comments, links, "", "", item, "", "","",""); ViewData["Id"] = Id; return PartialView(model); }
public ActionResult Discussion(string Id, string state, int itemId) { DataRepository helper = new DataRepository(); Item item = helper.getItem(itemId); IList<ItemComment> comments = helper.getComments(itemId); IList<Link> links = helper.getLinks(itemId); string topLink = helper.getTopLink(itemId); string youtubeLink = helper.getTopYoutubeLink(itemId); DiscussionViewModel model = new DiscussionViewModel(itemId, comments, links, Id, state, item,"","",topLink,youtubeLink); return View(model); }
public ActionResult DeleteLink(string Id, int ItemId) { DataRepository helper = new DataRepository(); helper.DeleteLink(Convert.ToInt32(Id)); IList<Link> links = helper.getLinks(ItemId); DiscussionViewModel model = new DiscussionViewModel(-1, null, links, "", "", null, "", "", "", ""); ViewData["Id"] = Id; return PartialView(model); }