public async Task <IActionResult> GetPlaces() { var places = await _placeAppService.GetAllAsync(); var json = places.Select(a => new SelectViewModel { Id = a.Id, Text = a.Name }); return(Json(json)); }
public async Task <IActionResult> GetPlacesForSelect() { var places = await _placeAppService.GetAllAsync(); places.Insert(0, new PlaceListDto { Id = 0, Name = "无" }); var json = places.Select(a => new SelectViewModel { Id = a.Id, Text = a.Name }); return(Json(json)); }