Esempio n. 1
0
        public void UpVote(int linkId)
        {
            string ipList = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            var    link   = db.Links.Where(x => x.LinkId == linkId).FirstOrDefault();

            Vote votey = new Vote
            {
                LinkId    = link.LinkId,
                IpAddress = ipList,
                DateAdded = DateTime.UtcNow
            };

            db.Votes.Add(votey);

            link.Votes = link.Votes + 1;
            db.SaveChanges();
            //return RedirectToAction("Home");
        }
Esempio n. 2
0
        // 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"));
        }
Esempio n. 3
0
 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"));
 }
Esempio n. 4
0
        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"));
        }