Your reports client returns list of business entities and you are trying to map them to single entity. I think you should map collection of business entities to collection of view models (currently you are trying to map collection to single view model):
using (var reportsClient = new ReportsClient())
{
List<BusinessService.Report.MeanData> model =
reportsClient.GetData(reportType, toDate, fromDate);
IEnumerable<DomainModels.Reports.MeanData> viewModel =
Mapper.Map<IEnumerable<DomainModels.Reports.MeanData>>(model);
}
return PartialView("_Grid", viewModel);
Move mapping creation to application start:
Mapper.CreateMap<DomainModels.Reports.MeanData, BusinessService.Report.MeanData>();
Also consider to use aliases if you have types with same name:
using BusinessMeanData = BusinessService.Reports.MeanData;
using MeanDataViewModel = DomainModel.Reports.MeanData;
Or (better) add ViewModel
suffix to name of type which acts as view model. In this case code will look like:
using (var reportsClient = new ReportsClient())
{
var model = reportsClient.GetData(reportType, toDate, fromDate);
var viewModel = Mapper.Map<IEnumerable<MeanDataViewModel>>(model);
}
return PartialView("_Grid", viewModel);