Example #1
0
 public void AddMedicine(Medicine medicine, HttpPostedFileBase httpPostedFile)
 {
     try
     {
         using (var ctx = new DrugsContext())
         {
             ctx.Medicines.Add(medicine);
             ctx.SaveChanges();
         }
         GoogleDriveAPITool.FileUpload(httpPostedFile);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
 public void UpdateMedicine(Medicine medicine, HttpPostedFileBase httpPostedFile)
 {
     try
     {
         Medicine med = GetMedicine(medicine.Id);
         GoogleDriveAPITool.DeleteGoogleFileByName(med.imagePath);
         using (var ctx = new DrugsContext())
         {
             ctx.Entry(medicine).State = EntityState.Modified;
             ctx.SaveChanges();
         }
         GoogleDriveAPITool.FileUpload(httpPostedFile);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }