Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }