private IdNameDTO TODTO(PostStatusEntity entity)
        {
            IdNameDTO dto = new IdNameDTO();

            dto.CreateTime  = entity.CreateTime;
            dto.Description = entity.Description;
            dto.Id          = entity.Id;
            dto.Name        = entity.Name;
            return(dto);
        }
        public async Task <long> AddNewAsync(AddIdNameDTO dto)
        {
            PostStatusEntity entity = new PostStatusEntity();

            entity.Description = dto.Description;
            entity.Name        = dto.Name;
            using (PostContext ctx = new PostContext())
            {
                BaseService <PostStatusEntity> bs = new BaseService <PostStatusEntity>(ctx);
                var status = await bs.GetAll().SingleOrDefaultAsync(e => e.Name == dto.Name);

                if (status != null)
                {
                    throw new Exception("帖子状态已存在");
                }
                await ctx.PostStatuses.AddAsync(entity);

                await ctx.SaveChangesAsync();

                return(entity.Id);
            }
        }