// GET: Place public ActionResult Index() { var _sportService = this.Service <ISportService>(); Country vietnam = AddressUtil.GetINSTANCE().GetCountry(Server.MapPath(AddressUtil.PATH)); var sportList = _sportService.getAllSport(); IEnumerable <SelectListItem> selectList = sportList.Select(s => new SelectListItem { Text = s.Name, Value = s.Id.ToString() }).ToArray(); ViewBag.SportList = selectList; var province = vietnam.VietNamese.ToList(); IEnumerable <SelectListItem> provinceList = province.Select(m => new SelectListItem { Text = m.Type + " " + m.Name, Value = m.Name }).OrderBy(s => s.Value).ToArray(); ViewBag.ProvinceList = provinceList; var viewModel = new SearchPlaceViewModel(); return(View(viewModel)); }
public JsonResult SearchPlace(SearchPlaceViewModel model) { if (model.ServiceType == null) { model.ServiceType = ""; } if (model.PlaceName == null) { model.PlaceName = ""; } Citizen user = User.Identity.GetCitizen(); List <MedicalPlace> medicalPlaces = new List <MedicalPlace>(); if (model.ServiceType.ToUpper().Equals("ICU") || model.PlaceName.ToUpper().Equals("ICU")) { medicalPlaces = MedicalPlaceBusinessLayer.SearchCareUnitsPlace(model.Latitude, model.Longitude, model.ServiceType, model.PlaceName, model.IsDistance, model.IsCost, model.IsRate, model.IsPopularity).ToList(); } else { medicalPlaces = MedicalPlaceBusinessLayer.SearchMedicalPlace(model.Latitude, model.Longitude, model.ServiceType, model.PlaceName, model.IsDistance, model.IsCost, model.IsRate, model.IsPopularity).ToList(); } var result = medicalPlaces.Select(place => new { place.ID, placeType = place.MedicalPlaceType.Name, place.Name, place.Address, place.Phone, Photo = string.Format("data:image/png;base64,{0}", Convert.ToBase64String(place.Photo)) }).ToList(); return(Json(new { places = result })); }