public async Task <IActionResult> AddVenueImagesAsync(Guid id) { IFormFileCollection fileCollection = Request.Form.Files; if (fileCollection.Count == 0) { return(BadRequest(new { message = $"Please add at least 1 image and less than 5 images for venue to continue. " })); } if (fileCollection.Count > 5) { return(BadRequest(new { message = $"Cannot upload more than 5 files, please reupload to continue. " })); } foreach (IFormFile uploadedFile in fileCollection) { if (!new string[] { "image/jpeg", "image/jpg", "image/png" }.Contains(uploadedFile.ContentType)) { return(BadRequest(new { message = "Invalid format, Uploaded file is not an image." })); } } List <(string HostedURL, string ResourceName)> hostedImageURLList = await _fileService.UploadFileToBlob(fileCollection, id); List <VenueImage> venueImages = hostedImageURLList.Select(x => new VenueImage { VenueImageID = Guid.NewGuid(), ContainerName = id.ToString(), HostedImageURL = x.HostedURL, ResourceName = x.ResourceName, VenueID = id }).ToList(); await _venueService.AddVenueImageAsync(venueImages); return(StatusCode(201, new { message = "Venue Images added successsfully." })); }