public ActionResult UpdateDoctor(int id, UpdateDoctorModel model, HttpPostedFileBase image)
        {
            ViewBag.doctorId = id;
            if (ModelState.IsValid)
            {
                try
                {
                    riversideLinqDataContext objLinq = new riversideLinqDataContext();
                    doctor objDoctor = objLinq.doctors.Single(x => x.id == id);

                    if (image != null)
                    {

                        //Delete old photo
                        var oldImage = objDoctor.photo_path;
                        string fullPath = Server.MapPath("~/Content/images/doctors/"
                        + oldImage);

                        if (System.IO.File.Exists(fullPath))
                        {
                            System.IO.File.Delete(Server.MapPath("~/Content/images/doctors/"
                        + oldImage));

                        }

                        //Upload new photo
                        string doctor_photo = Path.GetFileName(image.FileName);
                        string image_ext = Path.GetExtension(image.FileName);

                        doctor_photo = DateTime.UtcNow.Ticks + doctor_photo;
                        objDoctor.photo_path = doctor_photo;

                        string path = Path.Combine(Server.MapPath("~/Content/images/doctors/"), doctor_photo);
                        image.SaveAs(path);
                    }

                    objDoctor.department_name = model.department_name;
                    objDoctor.first_name = model.first_name;
                    objDoctor.last_name = model.last_name;
                    objDoctor.email = model.email;
                    objDoctor.phone = model.phone;
                    objDoctor.specialty = model.specialty;
                    objDoctor.bio = model.bio;

                    objLinq.SubmitChanges();

                    return RedirectToAction("DoctorProfile");
                }
                catch
                {
                    return View(model);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult UpdatePatient(int id, UpdatePatientModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    riversideLinqDataContext objLinq = new riversideLinqDataContext();
                    patient objPatient = objLinq.patients.Single(x => x.id == id);
                    objPatient.health_card = model.health_card;
                    objPatient.first_name = model.first_name;
                    objPatient.last_name = model.last_name;
                    objPatient.birth_date = model.birth_date;
                    objPatient.gender = model.gender;
                    objPatient.email = model.email;
                    objPatient.phone = model.phone;
                    objPatient.address = model.address;
                    objPatient.city = model.city;
                    objPatient.province = model.province;
                    objPatient.postal_code = model.postal_code;

                    objLinq.SubmitChanges();

                    return RedirectToAction("PatientProfile");
                }
                catch
                {
                    return View(model);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult UpdatePatient(int id, UpdatePatientModel model)
        {
            ViewBag.patientId = id;
            if (ModelState.IsValid)
            {
                try
                {
                    riversideLinqDataContext objLinq = new riversideLinqDataContext();
                    patient objPatient = objLinq.patients.Single(x => x.id == id);
                    objPatient.health_card = model.health_card;
                    objPatient.first_name = model.first_name;
                    objPatient.last_name = model.last_name;
                    objPatient.birth_date = model.birth_date;
                    objPatient.gender = model.gender;
                    objPatient.email = model.email;
                    objPatient.phone = model.phone;
                    objPatient.address = model.address;
                    objPatient.city = model.city;
                    objPatient.province = model.province;
                    objPatient.postal_code = model.postal_code;

                    objLinq.SubmitChanges();

                    //return RedirectToAction("PatientDetail/" + id);
                    return RedirectToAction("ListPatient");
                }
                catch
                {
                    return View(model);
                }
            }
            return View(model);
        }