public ActionResult AddLinkRequest(int itemId, string link) { //store new item, link and new comment(if not null) DataRepository helper = new DataRepository(); if (!helper.linkExists(link, itemId)) helper.AddLink(link, itemId, Session["Username"].ToString()); else { helper.LikeLinkInstead(link, itemId); TempData["LinkExists"] = "That link has already been added against this recommendation. We have liked this link instead."; } Item item = helper.getItemById(itemId.ToString()); return RedirectToAction("Discussion", new {Id = item.Username, state = "Network", itemId = itemId }); }
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" }); }