/// <summary> /// Inserts a new Role in the Roles table /// </summary> /// <param name="roleName">The role's name</param> /// <returns></returns> public int Insert(IdentityRole role) { string commandText = "Insert into Roles (Id, Name) values (@id, @name)"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@name", role.Name); parameters.Add("@id", role.Id); return _database.Execute(commandText, parameters); }
/// <summary> /// Gets the IdentityRole given the role Id /// </summary> /// <param name="roleId"></param> /// <returns></returns> public IdentityRole GetRoleById(string roleId) { var roleName = GetRoleName(roleId); IdentityRole role = null; if(roleName != null) { role = new IdentityRole(roleName, roleId); } return role; }
public int Update(IdentityRole role) { string commandText = "Update Roles set Name = @name where Id = @id"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@id", role.Id); return _database.Execute(commandText, parameters); }