예제 #1
0
 public CountryViewModel EntityToViewModel(Country country)
 {
     if (country is null)
     {
         return(null);
     }
     return(new CountryViewModel
     {
         Id = country.Id,
         Name = country.Name,
         States = country.States != null && country.States.Any()
                     ? _mapperState.ListEntityToViewModel(country.States)
                     : null
     });
 }
예제 #2
0
        public async Task <IEnumerable <StateViewModel> > GetAllAsync(int page, int pageSize)
        {
            var states = await _serviceState.GetAllAsync(page, pageSize);

            return(_mapperState.ListEntityToViewModel(states));
        }