public void CreatePost() { MensaheRepository mr = new MensaheRepository(); TagIyaRepository tir = new TagIyaRepository(); try { Mensahe msg = new Mensahe(); msg.Message = this.Message; msg.DatePosted = DateTime.Now; msg.DateEdited = DateTime.Now; mr.InsertMessage(msg, tir.GetTagIya(this.PostUserId)); } catch { throw; } }
public UsersModels GetUser() { if (this.UserId < 0) { throw new ArgumentNullException("UserId", "Primary key missing"); } TagIyaRepository tir = new TagIyaRepository(); try { var tagIya = tir.GetTagIya(this.UserId); return(GetUserModel(tagIya)); } catch { throw; } }
/// <summary> /// Get posts by User /// </summary> /// <param name="UserId">User Id</param> /// <returns></returns> public static List <PostsModels> GetPostsByUser(int UserId) { MensaheRepository mr = new MensaheRepository(); TagIyaRepository tir = new TagIyaRepository(); try { var msgs = mr.GetUserMessages(UserId); var tagIya = tir.GetTagIya(UserId); List <PostsModels> posts = new List <PostsModels>(); foreach (Mensahe msg in msgs) { PostsModels post = new PostsModels(); post = post.GetPostsModel(tagIya, msg); posts.Add(post); } return(posts); } catch { throw; } }