Пример #1
0
        public ActionResult listAll()
        {
            DiseaseViewModel model = new DiseaseViewModel();


            return(View(model));
        }
Пример #2
0
 public ActionResult Create(DiseaseViewModel model)
 {
     if (ModelState.IsValid)
     {
         model.AddedOn    = DateTime.UtcNow;
         model.ModifiedOn = DateTime.UtcNow;
         var newDisease = Mapper.Map <DiseaseViewModel, Disease>(model);
         diseaseService.InsertDisease(newDisease);
     }
     return(View());
 }
Пример #3
0
        public ActionResult AddDisease(HttpPostedFileBase filename, DiseaseViewModel model)
        {
            if (ModelState.IsValid)
            {
                //var result = db.TBL_DISEASE.Create(model)
                TBL_DISEASE mdl = new TBL_DISEASE();
                mdl.DISEASE_ID   = db.TBL_DISEASE.Add(mdl).DISEASE_ID;
                mdl.DISEASE_NAME = model.DISEASE_NAME;
                mdl.SYMPTOMS     = model.SYMPTOMS;
                mdl.CATEGORY     = model.CATEGORY;
                mdl.TREATMENT    = model.TREATMENT;
                //db.TBL_DISEASE.Add(mdl);

                //db.SaveChanges();
                if (db.SaveChanges() > 0)
                {
                    TBL_DISEASE_DETAILS dtl = new TBL_DISEASE_DETAILS();
                    dtl.DETAIL_ID           = db.TBL_DISEASE_DETAILS.Add(dtl).DISEASE_ID;
                    dtl.DISEASE_ID          = mdl.DISEASE_ID;
                    dtl.DISEASE_DESCRIPTION = model.DISEASE_Description;
                    dtl.TREATMENT           = model.TREATMENT_DETAILS;
                    dtl.SUGGESTION          = model.SUGGESTION;
                    if (filename != null)
                    {
                        string pic  = System.IO.Path.GetExtension(filename.FileName);
                        string name = Guid.NewGuid().ToString() + pic;
                        string path = System.IO.Path.Combine(
                            Server.MapPath("~/Contents/upload/Disease"), name);
                        // file is uploaded
                        filename.SaveAs(path);
                        dtl.IMAGE = name;
                    }
                    //db.TBL_DISEASE_DETAILS.Add(dtl);
                    //dtl.TREATMENT = model.TREATMENT;
                    db.SaveChanges();
                }


                if (mdl.DISEASE_ID > 0)
                {
                    return(Json(new { successMessage = "Successfully Registered!" }));
                }
                else
                {
                    Response.StatusCode = (int)HttpStatusCode.SeeOther;
                    return(Json(new { errorMessage = "Something went wrong!" }));
                }
            }
            else
            {
                return(PartialView(model));
            }
        }
        public async Task <PartialViewResult> ViewDiseaseModal(int id)
        {
            var getDiseaseForViewDto = await _diseasesAppService.GetDiseaseForView(id);

            var model = new DiseaseViewModel()
            {
                Disease = getDiseaseForViewDto.Disease
                ,
                Personname = getDiseaseForViewDto.Personname
            };

            return(PartialView("_ViewDiseaseModal", model));
        }
Пример #5
0
        public ActionResult EditDisease(HttpPostedFileBase filename, DiseaseViewModel model)
        {
            if (ModelState.IsValid)
            {
                var OldModel = db.TBL_DISEASE.Where(X => X.DISEASE_ID == model.DISEASE_ID).FirstOrDefault();
                OldModel.DISEASE_NAME = model.DISEASE_NAME;

                OldModel.SYMPTOMS = model.SYMPTOMS;
                OldModel.CATEGORY = model.CATEGORY;
                //OldModel.TREATMENT = model.TREATMENT;
                try
                {
                    db.SaveChanges();
                    if (1 == 1)
                    {
                        //TBL_DISEASE_DETAILS dtl = new TBL_DISEASE_DETAILS();
                        var dtl = db.TBL_DISEASE_DETAILS.Where(X => X.DISEASE_ID == model.DISEASE_ID).FirstOrDefault();
                        //dtl.DETAIL_ID = db.TBL_DISEASE_DETAILS.Add(dtl).DETAIL_ID;
                        dtl.DISEASE_ID          = model.DISEASE_ID;
                        dtl.DISEASE_DESCRIPTION = model.DISEASE_Description;
                        dtl.TREATMENT           = model.TREATMENT_DETAILS;
                        dtl.SUGGESTION          = model.SUGGESTION;
                        dtl.IMAGE = model.IMAGE;
                        if (filename != null)
                        {
                            string pic  = System.IO.Path.GetExtension(filename.FileName);
                            string name = Guid.NewGuid().ToString() + pic;
                            string path = System.IO.Path.Combine(
                                Server.MapPath("~/Contents/upload/Disease"), name);
                            // file is uploaded
                            filename.SaveAs(path);
                            dtl.IMAGE = name;
                        }
                        //db.TBL_DISEASE_DETAILS.Add(dtl);
                        //dtl.TREATMENT = model.TREATMENT;
                        db.SaveChanges();
                    }
                    return(Json(new { successMessage = "Successfully Updated !" }));
                }
                catch (Exception ex)
                {
                    return(Json(new { errorMessage = ex.ToString() }));
                }
            }
            else
            {
                return(PartialView(model));
            }
        }
Пример #6
0
        public ActionResult Details(int id)
        {
            var result = (from p in db.TBL_DISEASE
                          join q in db.TBL_DISEASE_DETAILS on p.DISEASE_ID equals q.DISEASE_ID
                          where p.DISEASE_ID.Equals(id)
                          select new { p, q }
                          ).FirstOrDefault();

            DiseaseViewModel doc = new DiseaseViewModel();

            doc.DISEASE_NAME        = result.p.DISEASE_NAME;
            doc.CATEGORY            = result.p.CATEGORY;
            doc.DISEASE_Description = result.q.DISEASE_DESCRIPTION;
            doc.IMAGE      = result.q.IMAGE;
            doc.SUGGESTION = result.q.SUGGESTION;
            doc.SYMPTOMS   = result.p.SYMPTOMS;

            doc.TREATMENT_DETAILS = result.q.TREATMENT;

            return(View(doc));
        }
Пример #7
0
        public ActionResult DiseaseDetails(int id)
        {
            DiseaseViewModel mdl = new DiseaseViewModel();
            var model            = (from p in db.TBL_DISEASE
                                    join q in db.TBL_DISEASE_DETAILS on p.DISEASE_ID equals q.DISEASE_ID
                                    where p.DISEASE_ID.Equals(id)
                                    select new { p, q }).FirstOrDefault();

            mdl.DISEASE_ID   = id;
            mdl.DISEASE_NAME = model.p.DISEASE_NAME;
            mdl.SYMPTOMS     = model.p.SYMPTOMS;
            mdl.CATEGORY     = model.p.CATEGORY;
            //mdl.TREATMENT = model.p.TREATMENT;
            mdl.IMAGE = model.q.IMAGE;
            mdl.DISEASE_Description = model.q.DISEASE_DESCRIPTION;
            mdl.TREATMENT_DETAILS   = model.q.TREATMENT;
            mdl.SUGGESTION          = model.q.SUGGESTION;


            return(PartialView(mdl));
        }
Пример #8
0
 public IActionResult Save(DiseaseViewModel diseaseViewModel)
 {
     if (ModelState.IsValid)
     {
         _diseasesRepository.SaveDisease(new Disease
         {
             DiseaseId = diseaseViewModel.DiseaseId,
             StartDate = diseaseViewModel.StartDate,
             EndDate   = diseaseViewModel.EndDate,
             Person    = new Person {
                 PersonId = diseaseViewModel.Person.Id
             },
             Symptoms = new List <DiseaseSymptom> (diseaseViewModel.Symptoms?.Select(x => new DiseaseSymptom {
                 SymptomId = x.Id
             }) ?? new DiseaseSymptom[] { })
         });
         return(RedirectToAction(nameof(List)));
     }
     else
     {
         return(View(nameof(Edit), diseaseViewModel));
     }
 }
Пример #9
0
        public ActionResult AddDisease()
        {
            DiseaseViewModel dvm = new DiseaseViewModel();

            return(PartialView(dvm));
        }
Пример #10
0
 public ActionResult Edit(DiseaseViewModel model)
 {
     return(View());
 }
Пример #11
0
        public ActionResult searchList(int?page, string searchKey, string searchfor)
        {
            int pageIndex = 1;
            int pageSize  = 4;

            pageIndex = page.HasValue ? Convert.ToInt16(page) : 1;
            if (searchfor == "doctor")
            {
                var result = (from p in db.TBL_DOCTOR
                              where p.ADDRESS.Contains(searchKey) || p.DOCTOR_NAME.Contains(searchKey) || p.EMAIL.Contains(searchKey) || p.SPECIALIZATION.Contains(searchKey) || p.WORK_HOSPITAL.Contains(searchKey)
                              select new { p }
                              ).ToList();

                List <TBL_DOCTOR> list = new List <TBL_DOCTOR>();
                foreach (var item in result)
                {
                    TBL_DOCTOR doc = new TBL_DOCTOR();
                    doc.ADDRESS        = item.p.ADDRESS;
                    doc.DOCTOR_ID      = item.p.DOCTOR_ID;
                    doc.SPECIALIZATION = item.p.SPECIALIZATION;
                    doc.DOCTOR_NAME    = item.p.DOCTOR_NAME;
                    doc.DOCTOR_IMAGE   = item.p.DOCTOR_IMAGE;
                    doc.DOCUMENT       = item.p.DOCUMENT;
                    doc.WORK_HOSPITAL  = item.p.WORK_HOSPITAL;
                    doc.CONTACT        = item.p.CONTACT;
                    doc.EMAIL          = item.p.EMAIL;
                    doc.GENDER         = item.p.GENDER;
                    list.Add(doc);
                }
                return(View("~/Views/User/listDoctors.cshtml", list.ToPagedList(pageIndex, pageSize)));
            }
            else if (searchfor == "Disease")
            {
                var result = (from p in db.TBL_DISEASE
                              join q in db.TBL_DISEASE_DETAILS on p.DISEASE_ID equals q.DISEASE_ID
                              where p.DISEASE_NAME.Contains(searchKey) || p.CATEGORY.Contains(searchKey) || p.SYMPTOMS.Contains(searchKey)
                              select new
                {
                    p,
                    q
                }
                              ).ToList();

                List <DiseaseViewModel> list = new List <DiseaseViewModel>();
                foreach (var item in result)
                {
                    DiseaseViewModel doc = new DiseaseViewModel();
                    doc.DISEASE_ID   = item.p.DISEASE_ID;
                    doc.DISEASE_NAME = item.p.DISEASE_NAME;
                    doc.CATEGORY     = item.p.CATEGORY;

                    doc.SYMPTOMS = item.p.SYMPTOMS;
                    //doc.WORK_HOSPITAL = item.p.WORK_HOSPITAL;
                    //doc.CONTACT = item.p.CONTACT;
                    //doc.EMAIL = item.p.EMAIL;
                    //doc.GENDER = item.p.GENDER;
                    list.Add(doc);
                }
                return(View("~/Views/DIsease/listAll.cshtml", list.ToPagedList(pageIndex, pageSize)));
            }
            else if (searchfor == "hospital")
            {
                var result = (from p in db.TBL_HOSPITAL
                              where p.HOSPITAL_ADDRESS.Contains(searchKey) || p.HOSPITAL_NAME.Contains(searchKey) || p.SPECIALIZATION.Contains(searchKey)
                              select new { p }
                              ).ToList();

                List <TBL_HOSPITAL> list = new List <TBL_HOSPITAL>();
                foreach (var item in result)
                {
                    TBL_HOSPITAL doc = new TBL_HOSPITAL();
                    doc.HOSPITAL_NAME    = item.p.HOSPITAL_NAME;
                    doc.HOSPITAL_ADDRESS = item.p.HOSPITAL_ADDRESS;
                    doc.SPECIALIZATION   = item.p.SPECIALIZATION;
                    doc.HOSPITAL_ID      = item.p.HOSPITAL_ID;
                    doc.HOSPITAL_IMAGE   = item.p.HOSPITAL_IMAGE;

                    list.Add(doc);
                }
                return(View("~/Views/User/listHospital.cshtml", list.ToPagedList(pageIndex, pageSize)));
            }
            return(View());
        }