public JsonResult GetCountries(CountryViewModel cViewModel) { PaginationInfo pager = new PaginationInfo(); pager = cViewModel.Pager; PaginationViewModel pViewModel = new PaginationViewModel(); try { pViewModel.dt = _cRepo.GetCountries(cViewModel.Country.CountryCode, cViewModel.Country.CountryName, ref pager); pViewModel.Pager = pager; Logger.Debug("Country Controller GetCountries"); } catch (Exception ex) { cViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01")); Logger.Error("Country Controller - GetCountries" + ex.ToString()); } return(Json(JsonConvert.SerializeObject(pViewModel), JsonRequestBehavior.AllowGet)); }
public async void GetCountriesTest_CheckIfReturnedListContains2Objects() { //Arrange IList <CountryModel> countries = GenerateCountries(); var travelAPIContextMock = new Mock <TravelAPIContext>(); travelAPIContextMock.Setup(c => c.Countries).ReturnsDbSet(countries); var logger = Mock.Of <ILogger <CountryRepo> >(); var countriesRepository = new CountryRepo(travelAPIContextMock.Object, logger); //Act var theCountries = await countriesRepository.GetCountries(); //Assert Assert.Equal(3, theCountries.Count); }
public List <CountryInfo> Drp_GetCountries() { return(_countryRepo.GetCountries()); }
public DataTable GetCountries(string CountryCode, string CountryName, ref PaginationInfo pager) { return(_countryRepo.GetCountries(CountryCode, CountryName, ref pager)); }