Ошибка передачи типа в модель

View:

@model ReportCheckViewModel
@{
    ViewData["Title"] = "Отчет по 071 счету";
}

Model:

public class ReportCheckViewModel
    {
        public List<ReportCheck> Checks { get; set; } = new List<ReportCheck>();
    }

Controller Action:

[Route("info-071-check")]
public async Task<IActionResult> Report071Check()
{

    ReportCheckViewModel viewModel = new ReportCheckViewModel()
    {
       ..., ...
    };
    return View(viewModel);
}

Error: An unhandled exception occurred while processing the request. InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'EngeneerLenRooAspNet.ViewModels.ReportCheckViewModel', but this ViewDataDictionary instance requires a model item of type 'System.Collections.Generic.List`1[EngeneerLenRooAspNet.Models.Employee]'.

Как так получается, что в вьюху все правильно передается, а пишет ошибку?


Ответы (0 шт):