コード例 #1
0
 public List <dynamic> AddPreventitive([FromBody] Preventative_Measure preventative_Measure)
 {
     if (preventative_Measure != null)
     {
         MalariaEntities1 db = new MalariaEntities1();
         db.Configuration.ProxyCreationEnabled = false;
         db.Preventative_Measure.Add(preventative_Measure);
         db.SaveChanges();
         return(getAllPreventitive());
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
 public List <dynamic> UpdatePreventitive([FromBody] Preventative_Measure preventative_Measure)
 {
     if (preventative_Measure != null)
     {
         MalariaEntities1 db = new MalariaEntities1();
         db.Configuration.ProxyCreationEnabled = false;
         Preventative_Measure objPrev = db.Preventative_Measure.Where(p => p.Preventative_Measure_ID == preventative_Measure.Preventative_Measure_ID).FirstOrDefault();
         objPrev.Measure_Description = preventative_Measure.Measure_Description;
         db.SaveChanges();
         return(getAllPreventitive());
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
        public List <dynamic> DeleteMeasure(int ID)
        {
            MalariaEntities1 db = new MalariaEntities1();

            db.Configuration.ProxyCreationEnabled = false;
            Preventative_Measure objPrev = db.Preventative_Measure.Where(p => p.Preventative_Measure_ID == ID).FirstOrDefault();

            if (objPrev != null)
            {
                db.Preventative_Measure.Remove(objPrev);
                db.SaveChanges();
                return(getAllPreventitive());
            }
            else
            {
                return(null);
            }
        }