mvc : convert view model code to viewbag or viewdata <p>I am sending my table data to mvc web page through using viewmodel....my code is below..now i am given the task to send it through viewbag or viewdata. Any passionate programer plz edit the code to send it throgh viewbag or viedata and give a basic overview about how we use them i.e viewmodel or viebag difrntly. Much thanx in advance.</p> <pre><code> @{ ViewBag.Title = "Index"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;div&gt; &lt;br /&gt;&lt;br /&gt; &lt;table style="width: 100%;"&gt; &lt;tr&gt; &lt;th&gt;UserID&lt;/th&gt; &lt;th&gt;UserName&lt;/th&gt; &lt;th&gt;Adress&lt;/th&gt; &lt;/tr&gt; @foreach(var item in ViewData.Model) { &lt;tr&gt; &lt;td&gt;@item.UserID&lt;/td&gt; &lt;td&gt;@item.Username&lt;/td&gt; &lt;td&gt;@item.Adress&lt;/td&gt; &lt;/tr&gt; } &lt;/table&gt; &lt;/div&gt; public class DetailController : Controller { public ActionResult Index() { ViewData.Model = DetailModels.GetData(); return View(); } } public class DetailModels { public static List&lt;User&gt; GetData() { EmployeeEntities context = new EmployeeEntities(); List&lt;User&gt; dt = context.Users.AsEnumerable().ToList(); return dt; } } </code></pre>