I may just tired, frustrated and grabbing at straws but here goes.
I tried using Areas in my MVC Web app and was running into issues with resolving paths so I moved my admin page back in to the main area.
When I did the Admin controller gets called which in turn invokes the Admin/Index page which loads in a partial page and it all gets filled with a list of List<commentviewmodel> information that I send it but when it's done servicing the list, and I don't know at what point this happens I get an exception saying that the page is looking for a list List<userviewmode> of information that's required in my Home/Index page??
Layout.cshtml - Admin page is the one in question
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
<li>
@if (User.IsInRole("Admin"))
{
@Html.ActionLink("Admin", "Index", "Admin")
}
</li>
RouteConfig.cs
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "JaxCoderV20.Controllers" }
);
}
AdminController.cs
[HttpGet]
public ActionResult Index()
{
List<CommentViewModel> list = UberService.GetAllCommentsExtended();
return View(list);
}
and a portion of Index.cshtml
@using JaxCoderV20.ViewModels;
@Model IEnumerable<jaxcoder.viewmodels.commentviewmodel>
@{
ViewBag.Title = "Admin Main Page";
ViewBag.Description = "Main entry point/page for Admin";
Layout = "~/Views/Shared/_Layout.cshtml";
}
.............. More suuff here ............
<div id="approval" class="tab-pane">
<a href="DownloadHandler.ashx?fileid=922528934">Article Source (81KB)</a>
@foreach (var item in Model)
{
Html.RenderPartial("_CommentView", (CommentViewModel)item);
}
</div>
I'm new to MVC so I'll probably be posting a lot of questions here so if you spot that I'm doing something wrong pipe up and let me know so I don't flouder latter. Thanks y'all