Hi
I have added one additional column to the existing AspNetUsers . The column name IsAuthorised . Some user have the value 0 and some users have the value 1 against this column. How can I get the value in controller to get the login user is with IsAuthorised = true or false. How can I check in my cntroller please help
namespace MetaWeather.Areas.Customer.Controllers { [Area("Customer")] [Authorize] public class ForcastController : Controller { private readonly IWeatherRepository _weatherRepository; private readonly IUnitOfWork _unitOfWork; public Weather Weather { get; set; } public ForcastController(IWeatherRepository weatherRepository, IUnitOfWork unitOfWork) { _weatherRepository = weatherRepository; _unitOfWork = unitOfWork; } public async Task<IActionResult> Index() { bool isAuthorisdUser = //how can I get the value from login user IsAuthorised }
public class InputModel { [Required] [EmailAddress] [Display(Name = "Email")] public string Email { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [DataType(DataType.Password)] [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } [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; } }