//add new patient report
 public void POST(patient_report report)
 {
     using (ThyroidDataEntities entities = new ThyroidDataEntities())
     {
         entities.patient_report.Add(report);
         //entities.SaveChanges();
         try
         {
             entities.SaveChanges();
         }
         catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
         {
             Exception raise = dbEx;
             foreach (var validationErrors in dbEx.EntityValidationErrors)
             {
                 foreach (var validationError in validationErrors.ValidationErrors)
                 {
                     string message = string.Format("{0}:{1}",
                                                    validationErrors.Entry.Entity.ToString(),
                                                    validationError.ErrorMessage);
                     // raise a new exception nesting
                     // the current instance as InnerException
                     raise = new InvalidOperationException(message, raise);
                 }
             }
             throw raise;
         }
     }
 }
 //delete report by report_id
 public string Delete(int id)
 {
     using (ThyroidDataEntities entities = new ThyroidDataEntities())
     {
         patient_report reportid = entities.patient_report.Find(id);
         entities.patient_report.Remove(reportid);
         entities.SaveChanges();
         return("Report Deleted Successfully");
     }
 }
        //update report
        public void PUT(int id, patient_report report)
        {
            using (ThyroidDataEntities entities = new ThyroidDataEntities())
            {
                var report1 = entities.patient_report.Find(id);
                report1.FT4       = report.FT4;
                report1.TSH       = report.TSH;
                report1.timestamp = report.timestamp;

                entities.Entry(report1).State = System.Data.Entity.EntityState.Modified;
                entities.SaveChanges();
            }
        }