Exemplo n.º 1
0
        public async Task <MessageModel <string> > Post([FromBody] blogarticle blogarticle)
        {
            var data = new MessageModel <string>();

            blogarticle.bCreateTime = DateTime.Now;
            blogarticle.bUpdateTime = DateTime.Now;
            blogarticle.IsDeleted   = false;
            //blogarticle.bcategory = "技术博文";

            var id = (await _blogarticleServices.Add(blogarticle));

            data.success = id > 0;
            if (data.success)
            {
                data.response = id.ObjToString();
                data.msg      = "添加成功";
            }

            return(data);
        }
Exemplo n.º 2
0
        public async void Add_Blog_Test()
        {
            blogarticle blogarticle = new blogarticle()
            {
                bCreateTime = DateTime.Now,
                bUpdateTime = DateTime.Now,
                btitle      = "xuint test title",
                bcontent    = "xuint test content",
                bsubmitter  = 1,
            };

            var BId = await blogarticleServices.Add(blogarticle);

            Assert.True(BId > 0);
        }
Exemplo n.º 3
0
        public async Task <MessageModel <string> > Post(blogarticle request)
        {
            var data = new MessageModel <string>();

            request.bCreateTime = DateTime.Now;
            request.bUpdateTime = DateTime.Now;
            request.IsDeleted   = false;
            request.bsubmitter  = _user.ID;
            request.bcommentNum = 0;
            request.btraffic    = 0;
            var id = await _blogarticleServices.Add(request);

            data.success = id > 0;

            if (data.success)
            {
                data.response = id.ObjToString();
                data.msg      = "添加成功";
            }
            return(data);
        }