示例#1
0
        public void DeleteStar(GetDeleteBlockStarInput input)
        {
            var star = _starRepository.Get(input.Id);
            if (star == null)
            {
                throw new UserFriendlyException("错误的明星ID!");
            }
            var blogs = star.Blogs;
            //这里不能使用foreach,否则出现“集合已修改;可能无法执行枚举操作”错误
            for (int i = 0; i > blogs.Count() - 1; i--)
            {
                _blogRepository.Delete(blogs.Last());
            }
            _starRepository.Delete(input.Id);

        }
示例#2
0
 public void BlockStar(GetDeleteBlockStarInput input)
 {
     var star = _starRepository.Get(input.Id);
     star.IsBlocked = input.IsBlocked;
 }
示例#3
0
 public StarWithBlogsDto GetStar(GetDeleteBlockStarInput input)
 {
     return (_starRepository.Get(input.Id)).MapTo<StarWithBlogsDto>();
 }