public async Task <IActionResult> AddCollection(NewCollectionModel dto) { var new_col = new NewCollectionDto { Name = dto.Name, Description = dto.Description, Preview = dto.Preview }; var ph = dto.PhotoPreview; byte[] p1 = null; using (var fs1 = ph.OpenReadStream()) using (var ms1 = new MemoryStream()) { fs1.CopyTo(ms1); p1 = ms1.ToArray(); } new_col.PhotoPreview = new NewPhotoDto { Data = p1, Type = "Logo" }; var response = await _collectionApiClient.AddCollectionAsync(new_col); return(Redirect($"~/Collection/AddCollectionSol?id={response.Data.Id}")); }
/// <summary> /// Добавить коллекцию /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <CollectionDto> AddCollectionAsync(NewCollectionDto dto) { var result = await _collectionRepository.AddAsync(_mapper.Map <Collection>(dto)); await _collectionRepository.SaveChangesAsync(); return(_mapper.Map <CollectionDto>(result)); }
public async Task <IActionResult> AddCollectionAsync(NewCollectionDto dto) { var result = await _collectionService.AddCollectionAsync(dto); return(ApiResult(result)); }
public Task <ApiResponse <CollectionDto> > AddCollectionAsync(NewCollectionDto dto) { return(PostAsync <NewCollectionDto, ApiResponse <CollectionDto> >(_clientOptions.AddCollectionUrl, dto)); }