コード例 #1
0
        private async Task <List <CityListViewModel> > GetItemsAsync()
        {
            List <CityListViewModel> list = _repository.GetCities()
                                            .Select(p => ModelFactory.Create(p))
                                            .ToList();

            return(list);
        }
コード例 #2
0
 public async Task <IActionResult> RemoveCity(int Id)
 {
     if (Id > 0)
     {
         var cities   = _repository.GetCities();
         var toDelete = cities.Find(p => p.CityId == Id);
         _repository.Remove(toDelete);
         if (await _repository.Save())
         {
             return(Json(true));
         }
         else
         {
             return(Json(false));
         }
     }
     return(Json(false));
 }