Esempio n. 1
0
        //Constructor to fill some predefine data
        public Repository()
        {
            users = new List<User>();
            User _user = new User();
            _user.userID = 1;
            _user.username = "******";
            // User _user = new User();
            users.Add(_user);
            //Create a record in Wall

             // private  List<Comment> lstComments;
            List<Comment> lstComments = new List<Comment>();

            Comment comment = new Comment() { id = 1, Comments = "This is me laura", userid = 1,DateofComment=System.DateTime.Now.AddDays(-1) };
            lstComments.Add(comment);

            comment = new Comment() { id = 1, Comments = "This is great", userid = 1, DateofComment = System.DateTime.Now.AddDays(-2) };

            lstComments.Add(comment);

            lstWalls = new List<Wall>();
            Wall _wall = new Wall()
            {
                WallId = 1,
                UserComments = lstComments
            };
            lstWalls.Add(_wall);

            //Create a record in Suscribe
            lstsuscription = new List<Suscribe>();

            Suscribe _sus = new Suscribe()
            {
                Owner = true,
                userid = 1,
                WallId = 1
            };

            lstsuscription.Add(_sus);
        }
Esempio n. 2
0
        /// <summary>
        /// Save comments
        /// </summary>
        /// <param name="userid">identity of the user</param>
        /// <param name="scomment"></param>
        /// <returns>comments</returns>
        public Comment SaveComment(int userid,string scomment)
        {
            //int newlastid = lstComments.Last().id + 1;

            Comment comment = new Comment() { id = userid, Comments = scomment, userid = userid,DateofComment=System.DateTime.Now };
            //lstComments.Add(comment);

            //find the wall

            Wall _wall = GetWall(userid);
            _wall.UserComments.Add(comment);
              //  lstWalls.Add(_wall);

            return comment;
        }