Esempio n. 1
0
 partial void Deletecomment(comment instance);
 public void AddComment(comment comment)
 {
     db.comments.InsertOnSubmit(comment);
     db.SubmitChanges();
 }
Esempio n. 3
0
 partial void Insertcomment(comment instance);
Esempio n. 4
0
 partial void Updatecomment(comment instance);
Esempio n. 5
0
		private void detach_comments(comment entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Esempio n. 6
0
		private void attach_comments(comment entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
Esempio n. 7
0
 public void AddComment(comment comment)
 {
     db.comments.InsertOnSubmit(comment);
 }
        public ActionResult SavePlace(int userID, string latval, string longval, string placename, string comment, string town, string username)
        {
            place newplace = new place();
             newplace.UserID = userID;
             newplace.LatVal = Convert.ToDecimal(latval);
             newplace.LongVal = Convert.ToDecimal(longval);
             newplace.Name = placename;
             newplace.Username = username;
             newplace.Flag = 0;
             newplace.Town = town;

             var newplaceID = dataRepository.AddPlace(newplace);

             comment newcomm = new comment();
             newcomm.Comment1 = comment;
             newcomm.PlaceID = newplaceID;
             newcomm.UserID = userID;
             newcomm.Datetime = DateTime.Now;

             dataRepository.AddComment(newcomm);
             db.SubmitChanges();

             return new JsonpResult("Done");
        }
        public ActionResult SaveComment(int PID, int userID, string comment, string flag)
        {
            var username = dataRepository.getName(userID);
             comment newcomm = new comment();
             newcomm.Comment1 = comment;
             newcomm.PlaceID = PID;
             newcomm.UserID = userID;
             newcomm.Datetime = DateTime.Now;

             dataRepository.AddComment(newcomm);

             if (flag == "yes")
             {
                 comment newcomm2 = new comment();
                 newcomm2.Comment1 = username + " flagged this site for the Moderator.";
                 newcomm2.PlaceID = PID;
                 newcomm2.UserID = userID;
                 newcomm2.Datetime = DateTime.Now;
                 dataRepository.AddComment(newcomm2);
             }

             var dataContext = new hioDataContext();
             var data = from pl in dataContext.comments
                        where pl.PlaceID == PID
                        orderby pl.Datetime descending
                        select new
                        {
                            datetime = Convert.ToString(pl.Datetime),
                            comment = pl.Comment1,
                            username = pl.User.Comment,
                            CID = pl.CID,

                        };
             return new JsonpResult(new { cmts = data, ct = data.Count() });
        }