I'd like to use AutoMapper in order to map my ViewModel to domain model class. Also I'm using PagedList NuGet Package. I'm using it this way:
[Authorize]
[AutoMap(typeof(ErrorsLog), typeof(ErrorsLogViewModel))]
public ActionResult Errors(string searchString, string currentFilter, int? page)
{
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
var el = _er.GetErrorsLog();
ViewBag.CurrentFilter = searchString;
if (!String.IsNullOrEmpty(searchString))
{
el = el.Where(s => s.ErrorSource.Contains(searchString));
}
const int pageSize = 3;
int pageNumber = (page ?? 1);
return View("Errors", el.ToPagedList(pageNumber, pageSize));
}
Unfortunately I got error:
Missing type map configuration or unsupported mapping. Mapping types: ErrorsLog -> ErrorsLogViewModel DigitalHubOnlineStore.Models.ErrorsLog -> DigitalHubOnlineStore.ViewModels.ErrorsLogViewModel Destination path: ErrorsLogViewModel Source value: PagedList.PagedList`1[DigitalHubOnlineStore.Models.ErrorsLog]
How can I fix that?