/// <summary> /// Обновить подборку /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <CollectionDto> UpdateCollectionAsync(UpdateCollectionDto dto) { var result = await _collectionRepository.GetAsync(dto.Id); if (dto.Name != null) { result.Name = dto.Name; } if (dto.Description != null) { result.Description = dto.Description; } if (dto.Preview != null) { result.Preview = dto.Preview; } if (dto.PhotoPreview != null) { if (result.PhotoPreview == null) { result.PhotoPreview = _mapper.Map <Photo>(dto.PhotoPreview); } else { result.PhotoPreview.Data = dto.PhotoPreview.Data; } } if (dto.Solutions != null) { result.Solutions = _mapper.Map <ICollection <TruncSolution> >(dto.Solutions); } await _collectionRepository.SaveChangesAsync(); return(_mapper.Map <CollectionDto>(result)); }
public async Task <IActionResult> UpdateCollectionAsync([FromBody] UpdateCollectionDto dto) { return(ApiResult(await _collectionService.UpdateCollectionAsync(dto))); }
public Task <ApiResponse <CollectionDto> > UpdateCollectionAsync(UpdateCollectionDto dto) { return(PutAsync <UpdateCollectionDto, ApiResponse <CollectionDto> >(_clientOptions.UpdateCollectionUrl, dto)); }