Passing code to cshtml page Asp.net core Razor

Asked

Viewed 90 times

1

As I pass this code that is on a page . Cs to a cshtml page.

 ApplicationUser user = await UserManager.GetUserAsync(User);

This page is the layout, no Model and no DTO.

Thank you

  • Your page has a Model or DTO?

  • @Alexandrecavaloti I advise you to read this answer Difference between DTO and Viewmodel?

  • @Since, it depends a lot, I think it would be more feasible for you to indicate the problem you are having(why you want the ApplicationUser in View), maybe the solution is different from the way you’re trying.

1 answer

0

I didn’t quite understand the question, but you can try using Viewdata to send data from a file . Cs to a . cshtml
Example . Cs:

public IActionResult Index(){ ViewData["Codigo"] = user; }

Example . cshtml:

<h1> @ViewData["Codigo"] </h1>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.