private async Task AddDocumentsAsync(Doctor doctor, List <IFormFile> theFiles) { foreach (var f in theFiles) { if (f != null) { string mimeType = f.ContentType; string fileName = Path.GetFileName(f.FileName); long fileLength = f.Length; //Note: you could filter for mime types if you only want to allow //certain types of files. I am allowing everything. if (!(fileName == "" || fileLength == 0))//Looks like we have a file!!! { DoctorDocument d = new DoctorDocument(); using (var memoryStream = new MemoryStream()) { await f.CopyToAsync(memoryStream); d.FileContent.Content = memoryStream.ToArray(); } d.MimeType = mimeType; d.FileName = fileName; doctor.DoctorDocuments.Add(d); } ; } } }
public static void TypeDoctorDocument(string doctorDocument) { DoctorDocument.Click(); DoctorDocument.SendKeys(doctorDocument); }