asp.net mvc - Show some informations about a current user -


well here i'm trying build web application asp.net mvc, in terms of interaction database use entity framework , i'm using forms authentication too, show username of current user , name of agency works here 2 classes user :

public partial class utilisateur {     public utilisateur()     {         this.statut_demande = new hashset<statut_demande>();         this.liste_noir = new hashset<liste_noir>();     }      public short id_user { get; set; }     public short id_agence_appartenir { get; set; }     public string identifiant { get; set; }     public string mdp { get; set; }     public string role { get; set; }      public virtual agence agence { get; set; }     public virtual icollection<statut_demande> statut_demande { get; set; }     public virtual icollection<liste_noir> liste_noir { get; set; } } 

} , agency :

public partial class agence {     public agence()     {         this.demande_crÉdit = new hashset<demande_crÉdit>();         this.utilisateur = new hashset<utilisateur>();     }      public short id_agence { get; set; }     public string code_agence { get; set; }     public string adresse { get; set; }     public string nom_agence { get; set; }      public virtual icollection<demande_crÉdit> demande_crÉdit { get; set; }     public virtual icollection<utilisateur> utilisateur { get; set; } } 

}

in order show username of current user used :

<%:httpcontext.current.user.identity.name %> 

but can't find how display name of agency current user works, if can me please, i'm still beginner xd in advance

in mvc applications have use razor syntax. razor code blocks enclosed in @{ ... }

try:

@user.identity.name 

here can learn more it:

introduction asp.net web programming using razor syntax (c#)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -