Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
        public void RecordVote(int commentid, byte vote, int userid)
        {
            // check to see whether we already have this vote
            var thevote = DB.CommentVotes.SingleOrDefault(v =>
                v.CommentId == commentid &&
                v.UserId == userid
                );

            if (thevote != null)
            {
                // update the sucker
                thevote.Vote = vote;
            }
            else
            {
                // create new one
                thevote = new CommentVote()
                    {
                        CommentId = commentid,
                        Date = DateTime.Now,
                        UserId = userid,
                        Vote = vote
                    };
                DB.CommentVotes.InsertOnSubmit(thevote);
            }
            DB.SubmitChanges();
        }
Beispiel #2
0
 private void detach_CommentVotes(CommentVote entity)
 {
     this.SendPropertyChanging();
     entity.User = null;
 }
Beispiel #3
0
 private void attach_CommentVotes(CommentVote entity)
 {
     this.SendPropertyChanging();
     entity.User = this;
 }
Beispiel #4
0
 partial void DeleteCommentVote(CommentVote instance);
Beispiel #5
0
 partial void UpdateCommentVote(CommentVote instance);
Beispiel #6
0
 partial void InsertCommentVote(CommentVote instance);