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

login user is coming to the variable but cannot be assigned

$
0
0

I am trying to get the value of  the login user from the column  IsAuthorised . but when I debug the values is stored in var user but when I try to store the value of isauthorised column  it is not working 

 public class ForcastController : Controller
    {
        private readonly IWeatherRepository _weatherRepository;
        private readonly IUnitOfWork _unitOfWork;
        private readonly UserManager<IdentityUser> _userManager;

        public Weather Weather { get; set; }
        public ForcastController(IWeatherRepository weatherRepository, IUnitOfWork unitOfWork,
           UserManager<IdentityUser> userManager)
        {
            _weatherRepository = weatherRepository;
            _unitOfWork = unitOfWork;
            _userManager = userManager;
        }
        public async Task<IActionResult> Index()
        {
            // ApplicationUser applicationUser = await _userManager.GetUserAsync(User);
            var user = await _userManager.GetUserAsync(User); // The value is stored here while running
//I cannot get the value from the variable user
bool isAuth = user.IsAuthorised // IsAuthorised property is not showing . But when I run the value is stored on the variable user
 public class ApplicationUser : IdentityUser
    {
        [Required]
        public string Name { get; set; }
        public string StreetAddress { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string PostalCode { get; set; }
        public bool IsAuthorised { get; set; }
    }


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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