예제 #1
0
        public File DownloadDocument(string Inn)
        {
            File file = null;

            using (DBModel1 cm = new DBModel1())
            {
                documents doc = cm.Documents.FirstOrDefault(f => f.Inn == Inn);
                if (doc != null)
                {
                    file = new File()
                    {
                        Name = doc.FileName, Content = doc.Data
                    };
                }
            }
            return(file);
        }
예제 #2
0
 public void UploadDocument(string Inn, File file)
 {
     using (DBModel1 cm = new DBModel1())
     {
         var doc = cm.Documents.FirstOrDefault(f => f.Inn == Inn);
         if (doc != null)
         {
             cm.Documents.Remove(doc);
             cm.SaveChanges();
         }
         doc          = new documents();
         doc.FileName = file.Name;
         doc.Data     = file.Content;
         doc.Inn      = Inn;
         cm.Documents.Add(doc);
         cm.SaveChanges();
     }
 }