public DoctorMV openPatientCreate(int id = 0, DoctorMV model = null)
        {
            LookupBussiness look = new LookupBussiness();
            if (model == null)
            {
                model = new DoctorMV();

            }
            if (id != 0 && model != null)
            {
                var _class = clinic.DoctorTBLs.Find(id);
                model.areaname = _class.AreaTBL.AreaName;
                model.Areaid = _class.Areaid;
                model.cityname = _class.CityTBL.CityName;
                model.Cityid = _class.Cityid;
                model.Arealist = look.fillarea(model.Cityid);
                model.spec = _class.SpecialtyTBL.SpecialtyName;
                model.Specialtyid = _class.Specialtyid;

            }


            model.citylist = look.fillcity();
            model.speclist = look.fillspec();

            return model;

        }
        public ResponseMV editecustomer(DoctorMV doctor)
        {
            ResponseMV result = ValidateDoctor(doctor);
            if (result.IsValid == true)
            {
                var doctortemp = clinic.DoctorTBLs.Where(c => c.Doctorid == doctor.Doctorid).FirstOrDefault();

                
               
                doctortemp.DoctorName = doctor.DoctorName;
                doctortemp.Email = doctor.Email;
                doctortemp.Phone = doctor.Phone;
                doctortemp.Cityid = doctor.Cityid;
                doctortemp.Areaid = doctor.Areaid;
                doctortemp.Age = doctor.Age;
                doctortemp.Specialtyid = doctor.Specialtyid;
               
                clinic.SaveChanges();

             



            }
            return result;



        }
예제 #3
0
        // GET: Doctor/Edit/5
        public ActionResult Edit(int id)
        {
            DoctorMV resulltpatient = doctor.Selectdoctor(id);

            resulltpatient = doctor.openPatientCreate(id, resulltpatient);

            return(View(resulltpatient));
        }
예제 #4
0
        public ActionResult Details(int id)
        {
            ViewBag.list = new List <string>()
            {
                "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
            };
            DoctorMV resulltpatient = doctor.Selectdoctor(id);

            return(View(resulltpatient));
        }
        public ResponseMV ValidateDoctor(DoctorMV viewmodel)
        {
            ResponseMV result = new ResponseMV();
            if (string.IsNullOrEmpty(viewmodel.DoctorName))
                result.ErrorMessages.Add("DoctorName", "not found name");
            if (viewmodel.Specialtyid==null)
                result.ErrorMessages.Add("spec", "not found name");



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return result;
        }
예제 #6
0
        public ActionResult EditDoctor(DoctorMV modeldoctor)
        {
            ResponseMV result = doctor.editecustomer(modeldoctor);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess save     " + modeldoctor.DoctorName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                modeldoctor = doctor.openPatientCreate(modeldoctor.Doctorid, modeldoctor);
                return(View("Edit", modeldoctor));
            }
        }
예제 #7
0
        public ActionResult Createnewdoctor(DoctorMV newdoctor)
        {
            ResponseMV result = doctor.createnewpatient(newdoctor);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess save     " + newdoctor.DoctorName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newdoctor = doctor.openPatientCreate(model: newdoctor);
                return(View("Create", newdoctor));
            }
        }
        public ResponseMV createnewpatient(DoctorMV doctor)
        {
            ResponseMV result = ValidateDoctor(doctor);
            if (result.IsValid == true)
            {
                DoctorTBL doctortemp = new DoctorTBL();
                doctortemp. Doctorid = doctor.Doctorid;
                doctortemp. DoctorName = doctor.DoctorName;
                doctortemp. Email = doctor.Email;
                doctortemp. Phone = doctor.Phone;
                doctortemp. Cityid = doctor.Cityid;
                doctortemp. Areaid = doctor.Areaid;
                doctortemp. Age = doctor.Age;
                doctortemp. Specialtyid = doctor.Specialtyid;
                clinic.DoctorTBLs.Add(doctortemp);
                clinic.SaveChanges();
            }
            return result;


        }
예제 #9
0
        // GET: Doctor/Create
        public ActionResult Create()
        {
            DoctorMV doctoropen = doctor.openPatientCreate();

            return(View(doctoropen));
        }