public PostDTO GetPostByPostId(int postId) { Model.DTO.PostDTO postDTO = new PostDTO(); Model.Entity.Post postEntity = this._postRepository.Get(p => p.PostedBy == postId); if (postEntity != null) { postDTO.PostID = postEntity.PostID; postDTO.UserID = postEntity.PostedBy; postDTO.Position = postEntity.Position; postDTO.Company = postEntity.Company; postDTO.Location = postEntity.Location; postDTO.MinExp = postEntity.MinExp; postDTO.MaxExp = postEntity.MaxExp; postDTO.Description = postEntity.Description; postDTO.PostedOn = postEntity.PostedOn; } return(postDTO); }
public int AddPost(PostDTO post) { Model.Entity.Post objPost = new Model.Entity.Post(); objPost.PostID = getNewPostId(); objPost.Company = post.Company; objPost.Position = post.Position; objPost.MinExp = post.MinExp; objPost.MaxExp = post.MaxExp; objPost.Location = post.Location; objPost.ContactNumber = post.Contact; objPost.Description = post.Description; objPost.Keywords = string.Join("##", post.Keywords.ToArray()); objPost.PostedBy = post.UserID; objPost.PostedOn = DateTime.Now; _postRepository.Add(objPost); _unitOfWork.Commit(); return(objPost.PostID); }