private void btnUploadREportDocument_Click(object sender, EventArgs e) { List <Data.Models.File> UploadedFiles = Common.FileHandeling.FileHandeling.UploadFile( UseMultipleFileSelect: true, AutomaicallyAddFileToDatabase: false, ImagesOnly: false); //LookupEnrollentDocumentType EDT = null; //using (var Dbconnection = new MCDEntities()) //{ // EDT = (from a in Dbconnection.LookupEnrollentDocumentTypes // where a.LookupEnrollmentDocumentTypeID == (int)Common.Enum.EnumEnrollentDocumentTypes.Facilitator_Report // select a).FirstOrDefault<LookupEnrollentDocumentType>(); //}; foreach (Data.Models.File f in UploadedFiles) { AssessmentReport AR = new AssessmentReport() { AssessmentID = 0, File = f, ImageID = 0, DateReportUploaded = DateTime.Now, AssessmentReportID = 0 }; AssessmentReportList.Add(AR); } //foreach (EnrollmentDocument EDItem in CurrentEnrollment.EnrollmentDocuments) //{ // Dbconnection.EnrollmentDocuments.Attach(EDItem); // Dbconnection.Entry(EDItem).Reference(a => a.LookupEnrollentDocumentType).Load(); //} this.refreshDocumentUploads(); }