@using DAL @model Personne @{ string title = "Annuaire"; ViewBag.Title = title; string message = ViewBag.Message; IDictionary dicoTitres = ViewBag.Titres; var titreItems = dicoTitres.Values.Select( t => new SelectListItem() { Text = t.Civilite, Value = t.Id.ToString() } ); IEnumerable personnes = ViewBag.Personnes; }

@title

@using( Html.BeginForm( "Rechercher", "Annuaire", FormMethod.Get, new { @class = "form-horizontal", role = "form" } ) ) {
@Html.DropDownListFor( m => m.TitreId, titreItems, string.Empty, new { @class = "form-control" } )
@Html.TextBoxFor( m => m.Prenom, new { @class = "form-control" } )
@Html.TextBoxFor( m => m.Nom, new { @class = "form-control" } )
@Html.TextBoxFor( m => m.Telephone, new { @class = "form-control" } )
} @if( personnes != null ) {

@message

@foreach( var p in personnes ) { }
Actions @Html.DisplayNameFor( m => m.TitreId ) @Html.DisplayNameFor( m => m.Prenom ) @Html.DisplayNameFor( m => m.Nom ) @Html.DisplayNameFor( m => m.Telephone )
- @dicoTitres[p.TitreId].Civilite @p.Prenom @p.Nom @p.Telephone
}