In order to login, logged in user, displayed on all pages, I did this:
_Layout.cshtml
... <footer> <p>Логин: @User.Identity.Name</p> </footer> ... But I still have to display the name of the school associated with this login. Cases is that there is a table in the database:
dbo.school
and logins (User.Identity.Name) are the same as the SchoolID field. How now to unload the corresponding SchoolName field and display it on each page of the site along with the login.
Of course, I can unload the information itself by implementing the IRepository interface:
HomeController.cs
public class HomeController : Controller { private cokoContext context = new cokoContext(); IRepository<school> schoolRepository; } public HomeController() { schoolRepository = new SchoolRepository(context); } But how exactly should the Контроллер continue to work from View ?
