// GET: Feed/Create public ActionResult Create(string url, string img) { using (NopComAddOnEntities context = new NopComAddOnEntities()) { Feed Feed = new Feed { FeedUrl = url, FeedImg = img }; context.Feeds.Add(Feed); context.SaveChanges(); } return(RedirectToAction("Home", "Link")); }
public ActionResult AddComment(int linkId, int customerId, string comment) { using (NopComAddOnEntities context2 = new NopComAddOnEntities()) { LinkComment linkComment = new LinkComment { CustomerId = customerId, LinkId = linkId, AddedDate = DateTime.UtcNow, CommentText = comment, Likes = 0 }; context2.LinkComments.Add(linkComment); context2.SaveChanges(); } return(RedirectToAction("Home")); }
public ActionResult Create(string stuff, string url, string image, DateTimeOffset publishDate) { using (NopComAddOnEntities context2 = new NopComAddOnEntities()) { Link link = new Link { Title = stuff, Url = url, Votes = 0, Author = "-Alex", DateAdded = publishDate.LocalDateTime, Image = image }; context2.Links.Add(link); context2.SaveChanges(); } return(RedirectToAction("Home")); }