public static List <UserClaimDetailViewModel> ConvertToDetailViewModelList(this List <bx_claim_detail> details) { List <UserClaimDetailViewModel> viewModels = new List <UserClaimDetailViewModel>(); foreach (bx_claim_detail detail in details) { UserClaimDetailViewModel vm = detail.ConverToDetailViewModel(); viewModels.Add(vm); } return(viewModels); }
public static UserClaimDetailViewModel ConverToDetailViewModel(this bx_claim_detail detail) { UserClaimDetailViewModel vm = new UserClaimDetailViewModel(); if (detail.endcase_time.HasValue) { vm.EndcaseTime = detail.endcase_time.Value.ToString("yyyy-MM-dd"); } if (detail.loss_time.HasValue) { vm.LossTime = detail.loss_time.Value.ToString("yyyy-MM-dd"); } vm.PayAmount = detail.pay_amount ?? 0; vm.PayCompanyName = detail.pay_company_name; vm.PayType = detail.pay_type ?? -1; return(vm); }
public static List <UserClaimDetailViewModel> ConvertToNewDetailList(this List <bx_claim_detail> details) { var list = new List <UserClaimDetailViewModel>(); if (!details.Any()) { return(list); } UserClaimDetailViewModel detail; foreach (var i in details) { detail = new UserClaimDetailViewModel { EndcaseTime = i.endcase_time.HasValue ? i.endcase_time.Value.ToString("yyyy-MM-dd") : "", LossTime = i.loss_time.HasValue ? i.loss_time.Value.ToString("yyyy-MM-dd") : "", PayAmount = i.pay_amount.HasValue ? i.pay_amount.Value : 0, PayCompanyName = i.pay_company_name ?? "", PayType = i.pay_type ?? -1 }; list.Add(detail); } return(list); }