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 RecSongRequest(string songName,string artistName, string url, string comment) { //store new item, link and new comment(if not null) //HtmlScraper scraper = new HtmlScraper(); //scraper.ScrapeUrl(url); //string body = scraper.GetBody(); //if (body.Contains(songName) && body.Contains(artistName)) //{ DataRepository helper = new DataRepository(); string name = songName + " by " + artistName; string username = Session["Username"].ToString(); int itemId = helper.AddItem(name, username, 1); helper.AddLink(url, itemId, username); if (comment != "") { helper.AddComment(username, itemId, comment); } return RedirectToAction("Index", new { Id = Session["Username"].ToString(), state = "Network" }); }
public ActionResult RecGameRequest(string gameName, string consoleName, string url, string comment) { //store new item, link and new comment(if not null) DataRepository helper = new DataRepository(); string name = gameName + " on " + consoleName; string username = Session["Username"].ToString(); int itemId = helper.AddItem(name, username, 4); helper.AddLink(url, itemId, username); if (comment != "") { helper.AddComment(username, itemId, comment); } return RedirectToAction("Index", new { Id = Session["Username"].ToString(), state = "Network" }); }