public static List <ContractorRateVm> GetContractorRatesList(bool getValidOnly = false) { EasyFreightEntities db = new EasyFreightEntities(); List <ContractorRateVm> contractRateVmList = new List <ContractorRateVm>(); var spResult = db.GetContractorRate(getValidOnly).ToList(); Mapper.CreateMap <GetContractorRate_Result, ContractorRateVm>().IgnoreAllNonExisting(); //.ForMember(c => c.FromAreaId, option => option.Ignore()) //.ForMember(c => c.ToAreaId, option => option.Ignore()).IgnoreAllNonExisting(); Mapper.Map(spResult, contractRateVmList); return(contractRateVmList); }