I would like to change GetRolesForUser
in the ASP .net MVC authorisation string to int. I would like to get value by user type id.
It was because I have multiple tables. So I would like to retrieve value by user type id. Is there any way to change to int for authentication?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using mylatestproject.Models;
namespace mylatestproject.MyRoleProvider
{
public class SiteRole : RoleProvider
{
public override string ApplicationName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public override void AddUsersToRoles(string[] usernames, string[] roleNames)
{
throw new NotImplementedException();
}
public override void CreateRole(string roleName)
{
throw new NotImplementedException();
}
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
{
throw new NotImplementedException();
}
public override string[] FindUsersInRole(string roleName, string usernameToMatch)
{
throw new NotImplementedException();
}
public override string[] GetAllRoles()
{ throw new NotImplementedException(); }
public override string[] GetRolesForUser(string username)
{
attendanceselangorEntities db = new attendanceselangorEntities();
string data = db.tblusers.Where(x => x.userNm == username).FirstOrDefault().userNm;
string[] result = { data };
return result;
}
public override string[] GetUsersInRole(string roleName)
{
throw new NotImplementedException();
}
public override bool IsUserInRole(string username, string roleName)
{
throw new NotImplementedException();
}
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
{
throw new NotImplementedException();
}
public override bool RoleExists(string roleName)
{
throw new NotImplementedException();
}
}
}
This source code has no error, But I want to change it to int.