mercredi 9 décembre 2015

Use LINQ to load users in MemberShip in MVC3 with C#

Hello wanted to know how I could use LINQ to list the data of users who did in this code:

@inherits System.Web.Mvc.WebViewPage<MembershipUserCollection>

@{
    ViewBag.Title = "Index";
}

  <h2>Table</h2>
  <table style="width: 100%;">
  <tr>
  <th>Nom
  </th>
  </tr>

    @foreach (MembershipUser user in Membership.GetAllUsers())
    {
  <tr>
    <td>
            @user.UserName

    </td>
    <td>
            @user.CreationDate
    </td>
    <td>
            @user.LastActivityDate
    </td>

</tr>
}

</table>

I do not understand is how to use LINQ to directly load data from users in membership, I mean charging all users and list these data in a comfortable foreach

As I can accomplish this?

Aucun commentaire:

Enregistrer un commentaire