//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); }
/// <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; }