public async Task <VmIndustryPage> GetIndustriesByPage(string keyword, int page, int totalRecords) { var dbPageResult = await repo.GetPage(keyword, (page == 0 ? Constants.app_firstPage : page), (totalRecords == 0 ? Constants.app_totalRecords : totalRecords)); if (dbPageResult == null) { return(new VmIndustryPage()); } var resultObj = new VmIndustryPage(); resultObj.RequestId = DateTime.Now.ToString("yyyyMMddHHmmss"); resultObj.RequestDate = DateTime.Now; resultObj.Result = new PageResult <VmIndustryItem>(); resultObj.Result.Records = new List <VmIndustryItem>(); Copy <PageResult <Industry>, PageResult <VmIndustryItem> >(dbPageResult, resultObj.Result, new string[] { "Records" }); foreach (var dbItem in dbPageResult.Records) { var resultItem = new VmIndustryItem(); Copy <Industry, VmIndustryItem>(dbItem, resultItem); resultObj.Result.Records.Add(resultItem); } return(resultObj); }