I have a cshtml view linked to a controller for a model for one table in my database, but I need to do a for each loop that references a second model for a second table. Since setting 2 models at the top of the page is not possible foreach (var row in model) wont work.

what I need is something like this

@model MVCapp.Models.COOKIE
@using MVCapp.Models;

  ViewBag.Title = "Update";

  foreach (var row in IEnumerable<MVCapp.Models.COOKIE_JARS)
     some code 


Although that is not aloud because I'm using a type like a variable. So what I am asking is if there is a way to set type:IEnumerable<MVCapp.Models.COOKIE_JARS to a variable or a second model, Or if there is a completely alternative method to achieve this looping through a second database table that I am trying to attempt.

Related posts

Recent Viewed