Why is this InvalidCastException: Specified cast is not valid error?

Viewed 32

It refers me the bellow line with the above error. Would appreciate your help.

'var model = await _context.EvaluationRisques.ToListAsync();'

Controller:

 // GET: EvaluationRisques
        [Authorize(Roles = "Administrateur, Modificateur, Lecteur")]
        public async Task<IActionResult> Index()
        {
            var model = await _context.EvaluationRisques.ToListAsync();
            var vm = _mapper.Map<List<EvaluationRisquesViewModel>>(model);
            return View(vm);
        }
0 Answers
Related