public async Task <IActionResult> Upload(List <IFormFile> files) { var list = new List <FileEntity>(); try { if (files == null || files.Count == 0) { return(BadRequest("no file uploaded. Upload a file with name 'files'.")); } foreach (var file in files) { if (file.Length <= 0) { continue; } var uploadedFile = await _fileUploadManager.Upload(file); list.Add(uploadedFile); } } catch (Exception e) { Console.WriteLine(e); throw; } var vmList = Mapper.Map <List <FileViewModel> >(list); return(Ok(vmList)); }