예제 #1
0
        public async Task <EntityNews> AddNewsAsync(EntityNews entityNews)
        {
            var newsRep = GetRepositoryInstance <TableNews>();

            //var newsRep = GetRepositoryInstance<TableNews>();

            //新闻已存在,直接返回
            if (newsRep.Find(x => x.Title == entityNews.Title) != null)
            {
                return(entityNews);
            }

            var model = new TableNews
            {
                NewsId       = GuidExtens.GuidTo16String(),
                Title        = entityNews.Title,
                ShortContent = entityNews.ShortContent,
                NewsContent  = entityNews.Content,
                CreateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                UpdateTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                IsEnable     = true,
                HrefUrl      = entityNews.HrefUrl ?? "",
                Media        = entityNews.Media ?? "",
                NewsImgUrl   = "",
                NewsType     = entityNews.NewsType
            };
            await newsRep.InsertAsync(model);

            entityNews.NewsId = model.NewsId;
            return(entityNews);
        }
예제 #2
0
 public EntityGroup()
 {
     Id       = GuidExtens.GuidToLongId();
     CreateAt = DateTime.Now;
     Remark   = "";
     Status   = EnumStatus.Enable;
 }
예제 #3
0
        public string UploadImg(byte[] imgdata)
        {
            var saveKey      = GuidExtens.GuidTo16String() + ".jpg";
            var token        = GetToken();
            var formUploader = new FormUploader();
            var result       = formUploader.UploadData(imgdata, saveKey, token);

            return(saveKey);
        }
예제 #4
0
 public EntityTask()
 {
     Id          = GuidExtens.GuidToLongId();
     CreateAt    = DateTime.Now;
     RequestJson = "";
     Remark      = "";
     Desc        = "";
     TaskStatus  = EnumStatus.Enable;
 }