Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Begineers Question on https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/intro

$
0
0

This may be a silly question but I don't get it.  Maybe I am bringing bad habits in from other coding I have done.

Take a simple set up like the below in the _layout.cshtml file

 <li><a asp-area="" asp-controller="Instructors" asp-action="Index">Instructors</a></li>
 <li><a asp-area="" asp-controller="Departments" asp-action="Index">Departments</a></li>

For discussion, why couldn't this be written:

string description = "Instructors"

<li><a asp-area="" asp-controller=description asp-action="Index">description</a></li>

description = "Departments"

<li><a asp-area="" asp-controller=description asp-action="Index">description</a></li>

And if this is possible why not set up a table and foreach through the table to populate the navbar as required?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>