Esempio n. 1
0
        public async Task Upload(IFormFile photo, PhotoView photoView)
        {
            var photoId = NewId.Next().ToGuid();
            await _amazonS3Repository.Upload(photo, photoId.ToString());

            var photoModel = _mapper.Map <Photo>(photoView);

            photoModel.Id          = photoId;
            photoModel.ImagePath   = $"{_s3Settings.ServiceURL}/{_s3Settings.BucketName}/{photoId.ToString()}";
            photoModel.DateCreated = DateTime.Now;

            await Task.WhenAll(_photosRepository.Upload(photoModel),
                               _hashtagsService.AddNewHashtags(photoId, photoModel.Description),
                               _feedService.AddPhotoToFeed(photoModel.UserId, photoModel));
        }