protected async Task<ActionResult<TOutModel>> CreatedItemAsync<TDtoIn, TInModel, TOutModel, TId>( IBlCreateAsync<TDtoIn, TDtoIn> service, TInModel value, IMapper mapper) where TOutModel : BaseModel<TId> { TDtoIn itemDto = mapper.Map<TInModel, TDtoIn>(value); itemDto = await service.CreateAsync(itemDto); var itemModel = mapper.Map<TDtoIn, TOutModel>(itemDto); return CreatedItem<TOutModel, TId>(itemModel); }
protected async Task<ActionResult<TOutModel>> CreatedItemAsync<TDto, TInModel, TOutModel, TId>( IBlCreateAsync<TDto, TDto> service, IImageService imageService, TInModel value, List<IFormFile> files, IMapper mapper) where TOutModel : BaseModel<TId> where TDto : BaseCommonDto { TDto itemDto = mapper.Map<TInModel, TDto>(value); itemDto.ImageIds = await imageService.CreateAsync(files); itemDto = await service.CreateAsync(itemDto); var itemModel = mapper.Map<TDto, TOutModel>(itemDto); return CreatedItem<TOutModel, TId>(itemModel); }