Esempio n. 1
0
        public HttpResponseMessage PutPatient(int id, PatientDetailDto patientdto)
        {
            Patient patient = new Patient()
            {
                Id               = patientdto.Id,
                Name             = patientdto.Name,
                Age              = patientdto.Age,
                Gender           = patientdto.Gender,
                Weight           = patientdto.Weight,
                DOB              = patientdto.DOB,
                ConsultingDoctor = patientdto.ConsultingDoctor,
                Disease          = patientdto.Disease,
                Contact          = patientdto.Contact,
                RegistrationFee  = patientdto.RegistrationFee,
                LastVisit        = patientdto.LastVisit,
                StatusFlag       = 0
            };


            if (!PatientExists(id))
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            db.Entry(patient).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, patient));
        }
        public ActionResult Create(AppointmentDetail appointmentDetail)
        {
            if (Session["UserEmail"] != null && Session["UserRole"].ToString() == "Doctor")
            {
                if (ModelState.IsValid)
                {
                    appointmentDetail.SheduleUpdated = false;
                    appointmentDetail.SheduleDate    = DateTime.Now;
                    db.AppointmentDetails.Add(appointmentDetail);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.PatientId = new SelectList(db.PatientDetails, "Patient_Id", "Name", appointmentDetail.PatientId);
                return(View(appointmentDetail));
            }
            Response.Write("<script>alert('Please Login')</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "PatientId,TreatmentDate,Treatment,Bill,TreatmentId,AppointmentId")] TreatmentDetail treatmentDetail)
        {
            if (Session["UserEmail"] != null && Session["UserRole"].ToString() == "Doctor")
            {
                if (ModelState.IsValid)
                {
                    treatmentDetail.TreatmentDate = DateTime.Now.Date;
                    db.TreatmentDetails.Add(treatmentDetail);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.AppointmentId = new SelectList(db.AppointmentDetails, "AppointmentId", "DiseaseInfo", treatmentDetail.AppointmentId);
                ViewBag.PatientId     = new SelectList(db.PatientDetails, "Patient_Id", "Name", treatmentDetail.PatientId);
                return(View(treatmentDetail));
            }
            Response.Write("<script>alert('Please Login')</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }
Esempio n. 4
0
 public ActionResult SignUp(PatientDetail patientDetail)
 {
     if (ModelState.IsValid)
     {
         patientDetail.UserType         = false;
         patientDetail.RegistrationDate = DateTime.Now;
         using (var context = new PatientManagementEntities())
         {
             context.PatientDetails.Add(patientDetail);
             context.SaveChanges();
             return(RedirectToAction("SignIn"));
         }
     }
     return(View());
 }
        public ActionResult Edit(AdviceDetail adviceDetail)
        {
            if (Session["UserEmail"] != null && Session["UserRole"].ToString() == "Doctor")
            {
                if (ModelState.IsValid)
                {
                    AdviceDetail objAdviceDetail = db.AdviceDetails.Where(x => x.AdviceId == adviceDetail.AdviceId).FirstOrDefault();

                    objAdviceDetail.DoctorMessage = adviceDetail.DoctorMessage;

                    objAdviceDetail.AdviceTime = DateTime.Now;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                ViewBag.PatientId = new SelectList(db.PatientDetails, "Patient_Id", "Name", adviceDetail.PatientId);
                return(View(adviceDetail));
            }
            Response.Write("<script>alert('Please Login')</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }
Esempio n. 6
0
        public ActionResult Create(AdviceDetail adviceDetail)
        {
            if (Session["UserEmail"] != null && Session["UserRole"].ToString() == "Patient")
            {
                if (ModelState.IsValid)
                {
                    adviceDetail.PatientId     = Convert.ToInt32(Session["UserId"]);
                    adviceDetail.AdviceTime    = DateTime.Now;
                    adviceDetail.DoctorMessage = "Please wait for reply.";
                    db.AdviceDetails.Add(adviceDetail);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.PatientId = new SelectList(db.PatientDetails, "Patient_Id", "Name", adviceDetail.PatientId);
                return(View(adviceDetail));
            }
            Response.Write("<script>alert('Please Login')</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }
Esempio n. 7
0
        public ActionResult Create(AppointmentDetail appoinmentDetail)
        {
            if (Session["UserEmail"] != null && Session["UserRole"].ToString() == "Patient")
            {
                if (ModelState.IsValid)
                {
                    //Remove this comment and static valure of user id
                    appoinmentDetail.PatientId = Convert.ToInt32(Session["UserId"]);
                    //appoinmentDetail.PatientId = 2;
                    appoinmentDetail.SheduleDate = DateTime.Now;

                    db.AppointmentDetails.Add(appoinmentDetail);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.PatientId = new SelectList(db.PatientDetails, "Patient_Id", "Name", appoinmentDetail.PatientId);
                return(View(appoinmentDetail));
            }
            Response.Write("<script>alert('Please Login')</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }