Exemple #1
0
        public async Task <InfoModel <bool> > ExaContent([FromForm] string id, [FromForm] int status)
        {
            var info = await ContentContext.GetInfo(HttpContext.RequestServices, id);

            info.Ver();
            await info.UpdateWithStatus((short)status);

            return(new InfoModel <bool>()
            {
                Data = true
            });
        }
Exemple #2
0
        public async Task <InfoModel <bool> > DeleteContent([FromForm] string id)
        {
            var info = await ContentContext.GetInfo(HttpContext.RequestServices, id);

            info.Ver();
            await info.MoveToRecycle();

            return(new InfoModel <bool>()
            {
                Data = true
            });
        }
Exemple #3
0
        public async Task <InfoModel <OutPutContentInfoItem> > GetInfo([FromForm] string Id)
        {
            var T = await ContentContext.GetInfo(HttpContext.RequestServices, Id);

            T.Ver();
            var list = await CommContext.GetListPageWithContentID(
                HttpContext.RequestServices,
                new PageInfo(0, 1000),
                Id
                );

            return(new InfoModel <OutPutContentInfoItem>()
            {
                Data = new OutPutContentInfoItem()
                {
                    Content = T.GetEntity().Content.HtmlDecode(),
                    ContentId = T.GetKey(),
                    CreateTiem = T.GetEntity().CreateDate.ToString("yyyy-MM-dd hh:mm:ss"),
                    HeadImage = new TempFileInfo()
                    {
                        ServerDirPath = T.GetDownFileDir(),
                        ServerFileName = T.GetEntity().Image,
                    },
                    Title = T.GetEntity().Title,
                    Status = T.GetEntity().Status,
                    Introduce = T.GetEntity().Introduce,
                    ExamineList = HttpContext.RequestServices.GetDataTypeForConstant <ContentStatusType>().DataType.ConvertAll(T =>
                    {
                        return new TypeForName <int, string>()
                        {
                            Id = T.Id,
                            Name = T.Value
                        };
                    }),
                    CommList = (await Task.WhenAll(list.ConvertAll(async K => {
                        return new Comminfo()
                        {
                            Content = K.GetEntity().Content,
                            DateTime = K.GetEntity().CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                            Name = await K.GetCreateName()
                        };
                    }))).ToList()
                }
            });
        }