Элемент модели, передаваемый в словарь, имеет тип 'system.collections.generic.list`1[alohomora.models.interviewquestions]', но для этого словаря требуется элемент модели типа 'alohomora.models.user'
Hi all, Here is my Model defined in MVC5 application:
Что я уже пробовал:
Это мое действие
public ActionResult CQuestions() { using (UserAccountContext userAccount = new UserAccountContext()) { return View(userAccount.InterviewQuestions.ToList<interviewquestions>()); } }
Это моя точка зрения
@model List<alohomora.models.interviewquestions> @{ ViewBag.Title = "CQuestions"; }
Это исключение
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[AlohoMora.Models.InterviewQuestions]', but this dictionary requires a model item of type 'AlohoMora.Models.User'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[AlohoMora.Models.InterviewQuestions]', but this dictionary requires a model item of type 'AlohoMora.Models.User'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
F-ES Sitecore
Код, который вы опубликовали, не может генерировать эту ошибку. Ошибка может быть вызвана частичным представлением, которое вы используете в представлении?