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 }); }
public async Task <IEnumerable <StateViewModel> > GetAllAsync(int page, int pageSize) { var states = await _serviceState.GetAllAsync(page, pageSize); return(_mapperState.ListEntityToViewModel(states)); }