Пример #1
0
        public void removeByUserId(string id_User)
        {
            List <DetailUserType> list = _detailUserTypeRepository.GetMulti(x => x.UserID == id_User).ToList();

            if (list != null)
            {
                foreach (DetailUserType item in list)
                {
                    _detailUserTypeRepository.Delete(item);
                }
            }
        }
Пример #2
0
        public List <Post> getPostByUserType(string id_user)
        {
            List <Post> listPost     = new List <Post>();
            List <int>  listPostType = _detailUserTypeRepository.GetMulti(x => x.UserID == id_user).Select(x => x.Type).ToList();

            if (listPostType == null)
            {
                listPostType = _postTypeRepository.GetAll().Select(x => x.Id).ToList();
            }
            foreach (int i in listPostType)
            {
                List <Post> postType = new List <Post>();
                postType = _postRepository.GetMulti(x => x.Id_Type == i).OrderByDescending(x => x.DatePost).ToList();
                listPost.AddRange(postType);
            }
            return(listPost.OrderByDescending(x => x.DatePost).ToList());
        }