public async Task <KnowledgeArticleKeyword> Get(long Id)
        {
            KnowledgeArticleKeyword KnowledgeArticleKeyword = await DataContext.KnowledgeArticleKeyword.AsNoTracking()
                                                              .Where(x => x.Id == Id)
                                                              .Select(x => new KnowledgeArticleKeyword()
            {
                Id   = x.Id,
                Name = x.Name,
                KnowledgeArticleId = x.KnowledgeArticleId,
                KnowledgeArticle   = x.KnowledgeArticle == null ? null : new KnowledgeArticle
                {
                    Id           = x.KnowledgeArticle.Id,
                    Title        = x.KnowledgeArticle.Title,
                    Detail       = x.KnowledgeArticle.Detail,
                    StatusId     = x.KnowledgeArticle.StatusId,
                    KMSStatusId  = x.KnowledgeArticle.KMSStatusId,
                    GroupId      = x.KnowledgeArticle.GroupId,
                    CreatorId    = x.KnowledgeArticle.CreatorId,
                    ItemId       = x.KnowledgeArticle.ItemId,
                    DisplayOrder = x.KnowledgeArticle.DisplayOrder,
                    FromDate     = x.KnowledgeArticle.FromDate,
                    ToDate       = x.KnowledgeArticle.ToDate,
                },
            }).FirstOrDefaultAsync();

            if (KnowledgeArticleKeyword == null)
            {
                return(null);
            }

            return(KnowledgeArticleKeyword);
        }
Beispiel #2
0
 public KnowledgeArticle_KnowledgeArticleKeywordDTO(KnowledgeArticleKeyword KnowledgeArticleKeyword)
 {
     this.Id   = KnowledgeArticleKeyword.Id;
     this.Name = KnowledgeArticleKeyword.Name;
     this.KnowledgeArticleId = KnowledgeArticleKeyword.KnowledgeArticleId;
     this.KnowledgeArticle   = KnowledgeArticleKeyword.KnowledgeArticle == null ? null : new KnowledgeArticle_KnowledgeArticleDTO(KnowledgeArticleKeyword.KnowledgeArticle);
     this.Errors             = KnowledgeArticleKeyword.Errors;
 }
        public async Task <bool> Create(KnowledgeArticleKeyword KnowledgeArticleKeyword)
        {
            KnowledgeArticleKeywordDAO KnowledgeArticleKeywordDAO = new KnowledgeArticleKeywordDAO();

            KnowledgeArticleKeywordDAO.Id   = KnowledgeArticleKeyword.Id;
            KnowledgeArticleKeywordDAO.Name = KnowledgeArticleKeyword.Name;
            KnowledgeArticleKeywordDAO.KnowledgeArticleId = KnowledgeArticleKeyword.KnowledgeArticleId;
            DataContext.KnowledgeArticleKeyword.Add(KnowledgeArticleKeywordDAO);
            await DataContext.SaveChangesAsync();

            KnowledgeArticleKeyword.Id = KnowledgeArticleKeywordDAO.Id;
            await SaveReference(KnowledgeArticleKeyword);

            return(true);
        }
        public async Task <bool> Update(KnowledgeArticleKeyword KnowledgeArticleKeyword)
        {
            KnowledgeArticleKeywordDAO KnowledgeArticleKeywordDAO = DataContext.KnowledgeArticleKeyword.Where(x => x.Id == KnowledgeArticleKeyword.Id).FirstOrDefault();

            if (KnowledgeArticleKeywordDAO == null)
            {
                return(false);
            }
            KnowledgeArticleKeywordDAO.Id   = KnowledgeArticleKeyword.Id;
            KnowledgeArticleKeywordDAO.Name = KnowledgeArticleKeyword.Name;
            KnowledgeArticleKeywordDAO.KnowledgeArticleId = KnowledgeArticleKeyword.KnowledgeArticleId;
            await DataContext.SaveChangesAsync();

            await SaveReference(KnowledgeArticleKeyword);

            return(true);
        }
 private async Task SaveReference(KnowledgeArticleKeyword KnowledgeArticleKeyword)
 {
 }
        public async Task <bool> Delete(KnowledgeArticleKeyword KnowledgeArticleKeyword)
        {
            await DataContext.KnowledgeArticleKeyword.Where(x => x.Id == KnowledgeArticleKeyword.Id).DeleteFromQueryAsync();

            return(true);
        }