我有一些概念,这些概念有概念子。所有这些插入在一起

时间:2021-07-13 05:06:32

标签: c# entity-framework-core

我有一些概念,这些概念有子概念。

所有这些都插入在一起。

现在我想更新这些。 例如Concept-1 包含三个子:conceptSub-1、conceptSub-2、conceptSub-3

我想更新这个(添加或删除他们的一个子)。

ConceptDto:

public Guid ConceptManagementId { get; set; }

public string ConceptName { get; set; }

public bool IsOriginalNameShow { get; set; }

public bool IsSubNameShow { get; set; }

public List<ConceptSubDto> ConceptSubSidiary { get; set; }

ConceptSubDto:

public Guid ConceptSubId { get; set; }

public string  ConceptSubName { get; set; }

这是我的服务:

  public async Task<bool> UpdateConcept(ConceptManagementDto dto)
        {
            var concept = await _conceptManagementRepository.Query().Include(x => x.conceptSubSidiaries)
                .GetOneAsync(x => x.Id == dto.ConceptManagementId);

            concept.EditConcept(dto.ConceptName,
                dto.IsSubNameShow,
                dto.IsOriginalName
            );


         ?
         ?
                   
        _conceptManagementRepository.Update(concept);
        await _conceptManagementRepository.SaveChangesAsync();
        return true;
    }

请你帮我弄清楚我在问号的地方遗漏了什么?

0 个答案:

没有答案