Example #1
0
        /// <summary>
        /// Add new suscription
        /// </summary>
        /// <param name="Requestuserid">requester user id</param>
        /// <param name="Suscriptionid">suscription user id</param>
        /// <returns></returns>
        public Suscribe AddSuscription(int Requestuserid, int Suscriptionid)
        {
            Suscribe ownersus = GetOwnerSuscription(Suscriptionid);
            int Wallid = ownersus.WallId;

            Suscribe NewSuscription = new Suscribe() { WallId = Wallid, userid = Requestuserid, Owner = false, ReadOnly = true };

            lstsuscription.Add(NewSuscription);
            return NewSuscription;
        }
Example #2
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);
        }
Example #3
0
        /// <summary>
        /// Save users
        /// </summary>
        /// <param name="name">name of the user</param>
        /// <returns>user</returns>
        public User SaveUser(string name)
        {
            int newlastid = users.Last().userID + 1;
            User _user = new User() {
                userID = newlastid,
                username = name};

            users.Add(_user);

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

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

            lstsuscription.Add(_sus);

            //Walls = new List<Wall>();
            Wall _wall = new Wall()
            {
                WallId = newlastid,
                UserComments = new List<Comment>()
            };
            lstWalls.Add(_wall);

            return _user;
        }