public ActionResult PatientEdit(int id) { //insert dropdowns BusinessLayer.PatientsBL patient = new BusinessLayer.PatientsBL(); List <SelectListItem> GenderList = (from gender in patient.GetGenders().ToList() select new SelectListItem() { Text = gender.GenderName, Value = gender.GenderId.ToString() }).ToList(); ViewBag.Gender = GenderList; List <SelectListItem> TitleList = (from title in patient.GetTitles().ToList() select new SelectListItem() { Text = title.TitleName, Value = title.TitleId.ToString() }).ToList(); ViewBag.Titles = TitleList; List <SelectListItem> IslandList = (from island in patient.GetIslands().ToList() select new SelectListItem() { Text = island.IslandName, Value = island.IslandId.ToString() }).ToList(); ViewBag.Island = IslandList; List <SelectListItem> tempList = new List <SelectListItem>(); ViewBag.Locality = tempList; BusinessLayer.Roles role = new BusinessLayer.Roles(); List <SelectListItem> WorkerList = (from worker in role.GetEmployeeWithRole("DOC").ToList() select new SelectListItem() { Text = worker.Person.FirstName + " " + worker.Person.LastName, Value = worker.EmployeesId.ToString() }).ToList(); ViewBag.KeyWorkers = WorkerList; List <SelectListItem> OriginOfReferralList = (from originOfReferral in patient.GetOriginOfReferrals().ToList() select new SelectListItem() { Text = originOfReferral.OriginOfReferralName, Value = originOfReferral.OriginOfReferralId.ToString() }).ToList(); ViewBag.OriginOfReferral = OriginOfReferralList; List <SelectListItem> DiagnosisList = (from diagnosis in patient.GetDiagnosisType().ToList() select new SelectListItem() { Text = diagnosis.DiagnosisName, Value = diagnosis.DiagnosisId.ToString() }).ToList(); ViewBag.Diagnosis = DiagnosisList; List <SelectListItem> RelativesAwareList = (from rAware in patient.GetRelativeAwareness().ToList() select new SelectListItem() { Text = rAware.RelativeAwareName, Value = rAware.RelativeAwareId.ToString() }).ToList(); ViewBag.RAware = RelativesAwareList; List <SelectListItem> PatientsAwareList = (from pAware in patient.GetPatientAwareness().ToList() select new SelectListItem() { Text = pAware.PatientAwareName, Value = pAware.PatientAwareId.ToString() }).ToList(); ViewBag.PAware = PatientsAwareList; List <SelectListItem> DecPlaceList = (from decPlace in patient.GetDeceasedPlaces().ToList() select new SelectListItem() { Text = decPlace.DeceasedPlaceName, Value = decPlace.DeceasedplaceId.ToString() }).ToList(); ViewBag.DecPlace = DecPlaceList; List <SelectListItem> FileStatusList = (from fileStatus in patient.GetFileStatuses().ToList() select new SelectListItem() { Text = fileStatus.FileStatusName, Value = fileStatus.FileStatusId.ToString() }).ToList(); ViewBag.FileStatus = FileStatusList; List <SelectListItem> PatientStatusList = (from patientStatus in patient.GetPatientStatuses().ToList() select new SelectListItem() { Text = patientStatus.PatientStatusName, Value = patientStatus.PatientStatusId.ToString() }).ToList(); ViewBag.PatientStatus = PatientStatusList; List <SelectListItem> OccupationList = (from occupation in patient.GetOccupations().ToList() select new SelectListItem() { Text = occupation.OccupationName, Value = occupation.OccupationId.ToString() }).ToList(); ViewBag.Occupation = OccupationList; List <SelectListItem> AccomodationList = (from accomodation in patient.GetAccommodations().ToList() select new SelectListItem() { Text = accomodation.AccommmodationName, Value = accomodation.AccommodationId.ToString() }).ToList(); ViewBag.Accomodation = AccomodationList; List <SelectListItem> MedicalTypeList = (from mType in patient.GetMedicalTypes().ToList() select new SelectListItem() { Text = mType.MedicalTypeName, Value = mType.MedicalTypeId.ToString() }).ToList(); ViewBag.MedicalType = MedicalTypeList; List <SelectListItem> RelationList = (from relation in patient.GetRelations().ToList() select new SelectListItem() { Text = relation.RelationName, Value = relation.RelationId.ToString() }).ToList(); ViewBag.Relation = RelationList; List <SelectListItem> EquipmentTypeList = (from equipmentType in patient.GetEquipmentTypes().ToList() select new SelectListItem() { Text = equipmentType.EquipmentTypeName, Value = equipmentType.EquipmentTypeId.ToString() }).ToList(); ViewBag.EquipmentType = EquipmentTypeList; BusinessLayer.UsersBL employees = new BusinessLayer.UsersBL(); List <SelectListItem> DoctorList = (from doctor in role.GetEmployeeWithRole("DOC").ToList() select new SelectListItem() { Text = doctor.Person.FirstName + " " + doctor.Person.LastName, Value = doctor.EmployeesId.ToString() }).ToList(); ViewBag.DoctorC = DoctorList; List <SelectListItem> FamilyDoctorList = (from familyDoctor in role.GetEmployeeWithRole("DOC").ToList() select new SelectListItem() { Text = familyDoctor.Person.FirstName + " " + familyDoctor.Person.LastName, Value = familyDoctor.EmployeesId.ToString() }).ToList(); ViewBag.FamilyDoctor = FamilyDoctorList; List <SelectListItem> OncologistList = (from oncologist in role.GetEmployeeWithRole("DOC").ToList() select new SelectListItem() { Text = oncologist.Person.FirstName + " " + oncologist.Person.LastName, Value = oncologist.EmployeesId.ToString() }).ToList(); ViewBag.Oncologist = OncologistList; Common.Patient CurrPat = patient.GetPatient(id); BusinessLayer.PatientsBL p = new BusinessLayer.PatientsBL(); Models.UIModel.PatientModel Model = new Models.UIModel.PatientModel(); Model.Patient = p.GetPatient(id); Model.Person = p.GetPerson(CurrPat.Personfk); Model.FamilySocial = p.GetFamilySocial(id); Model.Medication = p.GetMedication(id); Model.AllergiesSpiritual = p.GetAllergiesSpiritual(id); Model.IllnessesMedical = p.GetIllnessesMedical(id); Model.NextOfKin = p.GetNextOfKin(id); Model.CaseConferance = p.GetCaseConferance(id); Model.Equipment = p.GetEquipment(id); return(View(Model)); }