Exemple #1
0
        public void updateMedicinePicture(int medicineId, HttpPostedFileBase file)
        {
            GoogleDriveAPIHelper gd = new GoogleDriveAPIHelper();

            gd.deleteAllFiles(medicineId.ToString());
            gd.UplaodFileOnDriveInFolder(file, medicineId.ToString(), ConfigurationManager.AppSettings["FolderNameOnDrive"].ToString());
        }
Exemple #2
0
        public void addMedicine(Medicine medicine, HttpPostedFileBase file)
        {
            this.addMedicine(medicine);
            GoogleDriveAPIHelper gd = new GoogleDriveAPIHelper();

            gd.UplaodFileOnDriveInFolder(file, medicine.Id.ToString(), ConfigurationManager.AppSettings["FolderNameOnDrive"].ToString());
        }
Exemple #3
0
 public void deleteMedicine(Medicine medicine)
 {
     using (var context = new PrescriptionContext())
     {
         if (context.Medicines.ToList().Exists(mdn => mdn.Id == medicine.Id))
         {
             var deletedMedicine = context.Medicines.Where(m => m.Id == medicine.Id).FirstOrDefault();
             context.Medicines.Remove(deletedMedicine);
             context.SaveChanges();
             GoogleDriveAPIHelper gd = new GoogleDriveAPIHelper();
             gd.deleteFile(medicine.Id.ToString());
         }
         else
         {
             throw new Exception("This medicine does not exist");
         }
     }
 }
Exemple #4
0
        public string getMedicinePicture(int medicinId)
        {
            GoogleDriveAPIHelper gd = new GoogleDriveAPIHelper();

            return(gd.DownloadGoogleFileByName(medicinId.ToString()));
        }