diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs index 467d20f..eace01e 100644 --- a/DigitalData.Core.Application/CRUDService.cs +++ b/DigitalData.Core.Application/CRUDService.cs @@ -33,11 +33,12 @@ namespace DigitalData.Core.Application /// /// The DTO to create an entity from. /// A service result indicating success or failure, including the entity DTO. - public virtual async Task> CreateAsync(TCreateDto createDto) + public virtual async Task> CreateAsync(TCreateDto createDto) { var entity = _mapper.Map(createDto); var createdEntity = await _repository.CreateAsync(entity); - return createdEntity is null ? Result.Fail() : Result.Success(createdEntity.GetIdOrDefault()); + var dto = _mapper.Map(createdEntity); + return createdEntity is null ? Result.Fail() : Result.Success(dto); } /// diff --git a/DigitalData.Core.Application/Interfaces/ICRUDService.cs b/DigitalData.Core.Application/Interfaces/ICRUDService.cs index eafcca1..bd9f56f 100644 --- a/DigitalData.Core.Application/Interfaces/ICRUDService.cs +++ b/DigitalData.Core.Application/Interfaces/ICRUDService.cs @@ -12,7 +12,7 @@ namespace DigitalData.Core.Application.Interfaces /// /// The data transfer object containing the information for the new entity. /// A task representing the asynchronous operation, with a containing the identifier of the created entity or an error message. - Task> CreateAsync(TCreateDto createDto); + Task> CreateAsync(TCreateDto createDto); /// /// Updates an existing entity based on the provided updateDTO and returns the result wrapped in an IServiceMessage,