Пример #1
0
        public async Task AddPictureAsync(List <IFormFile> images, Guid hotelId)
        {
            var imageNames = new List <string>();

            foreach (var image in images)
            {
                if (image.Length > 0 && image.ContentType == "image/jpg" || image.ContentType == "image/png")
                {
                    var fileName = image.FileName;

                    var identifier = Guid.NewGuid();
                    var name       = identifier + fileName;

                    await _azureService.UploadAsync(image.OpenReadStream(), name);

                    imageNames.Add(name);
                }
            }

            _hotelService.AddImage(hotelId, imageNames);
        }