Example #1
0
 //update doctor advice
 public JsonResult updateDoctorAdvice(string ID, string adviceContent)
 {
     try
     {
         Guid   adviceID      = Guid.Parse(ID);
         advice updatedAdvice = db.advices.Find(adviceID);
         updatedAdvice.adviceContent   = adviceContent;
         db.Entry(updatedAdvice).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
     }
 }
Example #2
0
 //add new doctor advice
 public JsonResult addDoctorAdvice(string adviceContent)
 {
     try
     {
         advice newAdvice = new advice();
         newAdvice.adviceContent = adviceContent;
         newAdvice.id            = Guid.NewGuid();
         newAdvice.dateOfJoin    = DateTime.Now;
         newAdvice.doctorID      = getCurrentDoctor().id;
         db.advices.Add(newAdvice);
         db.SaveChanges();
         return(Json(new { status = true, newID = newAdvice.id }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
     }
 }