public IActionResult GetAll() { var result = _hospitalService.GetAll(); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
private void HospitalBind(int?i) { List <Hospital> list; if (i != null) { list = hospitalService.GetAll(x => x.CityId == i).ToList(); } else { list = hospitalService.GetAll().ToList(); } List <ComboBoxItem> combos = new List <ComboBoxItem>(); foreach (var item in list) { combos.Add(new ComboBoxItem(item.Name, item.Id)); } ComboBoxProp(cmbHospital, combos); }
public async Task <IActionResult> Index() { ViewBag.Lang = Lng; var hospitals = await(from h in _hospitalService.GetAll() select new ListHospitalsViewModel { HospitalId = h.Id, HospitalName = Lng == Lang.AR ? h.Name_Ar : Lng == Lang.KU ? h.Name_Ku : h.Name, HospitalDescription = Lng == Lang.AR ? h.Description_Ar : Lng == Lang.KU ? h.Description_Ku : h.Description, Address = Lng == Lang.AR ? h.Address_Ar : Lng == Lang.KU ? h.Address_Ku : h.Address, City = Lng == Lang.AR ? h.City.Name_Ar : Lng == Lang.KU ? h.City.Name_Ku : h.City.Name, }).ToListAsync(); return(View(hospitals)); }
private List <SelectListItem> GetHospitalSelectList() { // hospital select list List <SelectListItem> resultList = new List <SelectListItem>(); try { resultList = _hospitalService.GetAll().OrderBy(r => r.Name).Select(r => new SelectListItem() { Value = r.Id.ToString(), Text = r.Name }).ToList(); } catch { resultList = new List <SelectListItem>(); } return(resultList); }
private async Task <List <SelectListItem> > GetHospitalsSelectListAsync() { var hospitals = new List <SelectListItem> { new SelectListItem { Value = "", Text = "..." } }; var hospitalsLit = await _hospitalService.GetAll().Select(x => new SelectListItem { Value = x.Id.ToString(), Text = Lng == Lang.KU ? x.Name_Ku : Lng == Lang.AR ? x.Name_Ar : x.Name }).ToListAsync(); hospitals.AddRange(hospitalsLit); return(hospitals); }
public async Task <IActionResult> Index(DoctorsFilterDTO filterModel) { var cities = await _placeService.GetAllCities().Select(x => new SelectListItem { Text = Lng == Lang.KU ? x.Name_Ku : x.Name_Ar, Value = x.Id.ToString(), Selected = filterModel.City != null && filterModel.City == x.Id }).ToListAsync(); var hospitals = await _hospitalService.GetAll().Select(x => new SelectListItem { Text = Lng == Lang.KU ? x.Name_Ku : x.Name_Ar, Value = x.Id.ToString(), Selected = filterModel.Hospital != null && filterModel.Hospital == x.Id }).ToListAsync(); var expertises = await _expertiseService.AllExpertisesTable().Select(x => new SelectListItem { Text = Lng == Lang.KU ? x.Name_Ku : x.Name_Ar, Value = x.Id.ToString(), Selected = filterModel.Expertise != null && filterModel.Expertise == x.Id }).ToListAsync(); var clinicTypes = Enum.GetValues(typeof(ClinicType)).Cast <ClinicType>().ToList(); var clinicTypesSelectList = clinicTypes.Select(x => new SelectListItem { Text = x.ToString(), Value = clinicTypes.IndexOf(x).ToString(), Selected = filterModel.Clinic != null && filterModel.Clinic == clinicTypes.IndexOf(x) }).ToList(); ViewBag.Cities = cities; ViewBag.Hospitals = hospitals; ViewBag.Expertises = expertises; ViewBag.ClinicTypes = clinicTypesSelectList; ViewBag.Lng = _workContext.Locale; return(View(filterModel)); }