public ActionResult Appointments(string startTime, string endTime) { var currentUserId = Convert.ToInt32(Session["currentUserId"].ToString()); var todayDate = DateTime.Today.ToString("dd/MM/yyyy"); using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var verifyTimeSlot = db.Availabilities.Where(s => (s.DocId == currentUserId && s.Date == todayDate)).Count(); if (verifyTimeSlot >= 1) { return(new JsonResult { Data = false, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { Availability available = new Availability(); available.DocId = currentUserId; available.Date = todayDate; available.TimeStart = startTime; available.TimeEnd = endTime; db.Availabilities.Add(available); db.SaveChanges(); return(new JsonResult { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } } }
public JsonResult registerUser(User _model) { using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { db.Users.Add(_model); db.SaveChanges(); return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); } }
public JsonResult VerifyUserbyUserName(string UserName) { using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var user = db.Users.Where(s => s.UserName == UserName).FirstOrDefault(); user.IsVerified = true; db.SaveChanges(); return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); } }
public JsonResult VerifyUser() { using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var user = db.Users.OrderByDescending(s => s.UserId).FirstOrDefault(); user.IsVerified = true; db.SaveChanges(); return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteUser(int id) { using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var finddata = db.Users.Find(id); finddata.IsDeleted = true; db.SaveChanges(); } return(new JsonResult { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult ApproveOrRejactAppointment(int id, bool status) { using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var pat = db.PatientRequests.Find(id); pat.Status = status; db.SaveChanges(); return(new JsonResult { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public static bool AddNewAppointment(DateTime timeStart, DateTime timeEnd, int docId, int currentUserId) { var todaydate = DateTime.Today.ToString("dd/MM/yyyy"); using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { PatientRequest newReq = new PatientRequest(); newReq.UserId = currentUserId; newReq.DocId = docId; newReq.Date = todaydate; newReq.TimeStart = timeStart; newReq.TimeEnd = timeEnd; db.PatientRequests.Add(newReq); db.SaveChanges(); return(true); } }
public ActionResult AddPrescription(int id, string perscription) { var todaydate = DateTime.Today.ToString("dd/MM/yyyy"); using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { Prescription prescriptionDetail = new Prescription(); prescriptionDetail.PatientId = id; prescriptionDetail.Description = perscription; prescriptionDetail.Date = todaydate; db.Prescriptions.Add(prescriptionDetail); db.SaveChanges(); return(new JsonResult { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public ActionResult EnableDisable(int id) { bool status = false; using (DoctorAppoinmentDbContext db = new DoctorAppoinmentDbContext()) { var finddata = db.Users.Find(id); if (finddata.IsActive == true) { finddata.IsActive = false; } else { finddata.IsActive = true; status = true; } db.SaveChanges(); } return(new JsonResult { Data = status, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }