Monday, 15 August 2011

html - MVC View (Dont want to reapeat the Id's) -



html - MVC View (Dont want to reapeat the Id's) -

i have wcf service , and had generate records of clients have consumed free credit. have generated records clients same login id's repeating in records. dnt want display login id 1 time again want display numbers have called. here code of view

@model ienumerable<myyello.admin.models.callhistory> @{viewbag.title = "userswhohaveconsumedfreecredit"; layout = "~/views/shared/_layout.cshtml"; } <h2>users have consumed free credit</h2> <table class="table table-striped table-bordered tablesorter" style="display: block"> <thead> <tr> <th>login</th> <th>firstname</th> <th>lastname</th> <th>email</th> <th>country</th> <th>phone</th> <th>tarrifdesc</th> <th>callednum</th> <th>callstart</th> <th>callend</th> </tr> </thead> <tbody> @foreach (var item in model) { <tr> <td>@item.login</td> <td>@item.firstname</td> <td>@item.lastname</td> <td>@item.email</td> <td>@item.country</td> <td>@item.phone</td> <td>@item.tariffdescription</td> </tr> } @if (!model.any()) { <tr> <td colspan="14">no record found</td> </tr> } </tbody> </table>

just need thought how

you should grouping user login first then. here's example:

@foreach (var grouping in model.groupby(history => history.login)) { var item = group.first(); <tr> <td>@item.login</td> <td>@item.firstname</td> <td>@item.lastname</td> <td>@item.email</td> <td>@item.country</td> <td>@string.join(" - ", group.select(history => history.phone))</td> <td>@item.tariffdescription</td> </tr> }

html html5 asp.net-mvc-4 asp.net-mvc-views

No comments:

Post a Comment