public static CommentModel CommentToCommentModel(Comment comment)
        {
            if (comment != null)
            {
                CommentModel commentModel = new CommentModel();

                commentModel.CommentId = comment.CommentId;
                commentModel.UserProfileId = comment.UserProfileId;
                commentModel.EventId = comment.EventId;
                commentModel.CommentText = comment.CommentText;
                commentModel.Timestamp = comment.Timestamp;

                return commentModel;
            }
            else
            {
                return null;
            }
        }
        public bool CreateComment(CreateCommentModel createCommentModel)
        {
            Comment comment = new Comment();
            comment.CommentText = createCommentModel.Comment;
            comment.Timestamp = DateTime.Now;

            Event evt = db.Events.Where(ev => ev.EventId == createCommentModel.EventId).FirstOrDefault();
            UserProfile userProfile = db.UserProfiles.Where(up => up.UserProfileId == createCommentModel.UserProfileId).FirstOrDefault();

            comment.Event = evt;
            comment.UserProfile = userProfile;

            if (comment.Event != null && comment.UserProfile != null)
            {
                db.AddToComments(comment);
                db.SaveChanges();

                return true;
            }
            else
            {
                return false;
            }
        }
 /// <summary>
 /// Create a new Comment object.
 /// </summary>
 /// <param name="commentId">Initial value of the CommentId property.</param>
 /// <param name="commentText">Initial value of the CommentText property.</param>
 /// <param name="timestamp">Initial value of the Timestamp property.</param>
 /// <param name="userProfileId">Initial value of the UserProfileId property.</param>
 /// <param name="eventId">Initial value of the EventId property.</param>
 public static Comment CreateComment(global::System.Int32 commentId, global::System.String commentText, global::System.DateTime timestamp, global::System.Int32 userProfileId, global::System.Int32 eventId)
 {
     Comment comment = new Comment();
     comment.CommentId = commentId;
     comment.CommentText = commentText;
     comment.Timestamp = timestamp;
     comment.UserProfileId = userProfileId;
     comment.EventId = eventId;
     return comment;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Comments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToComments(Comment comment)
 {
     base.AddObject("Comments", comment);
 }