public async Task <List <IFormFile> > UploadImagesAsync(List <IFormFile> files, int hotelId) { var hotel = applicationContext.Hotels.Where(h => h.HotelId == hotelId).FirstOrDefault(); var wrongFiles = new List <IFormFile>(); var filePath = Path.GetTempFileName(); foreach (var file in files) { if (CheckImageExtension(file) && file.Length > 0 && hotel != null) { await SaveImagesIntoTempFolder(filePath, file); using (var stream = new FileStream(filePath, FileMode.Open)) { if (CheckImageSize(stream)) { var azurePath = GenerateAzurePath(hotelId, file); await UploadAsync(azurePath, stream); if (!hotel.Thumbnail) { await thumbnailService.UploadAsync(hotel, stream); } } else { wrongFiles.Add(file); } } } else { wrongFiles.Add(file); } } ; return(wrongFiles); }