i have some issue for view in cshtml page.. i already define foreach like this
<table>
<tr>
<th>Type</th>
<th>Name</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td> @Html.DisplayFor(modelItem => item.typeBook)</td>
<td> @Html.DisplayFor(modelItem => item.bookName)</td>
<tr>
}
</table>
and the view
Type | Name
Horror | Scary
Horror | Spooky
Jokes | Bean
but i want the view like this..
Type | Name
Horror | Scary , Spooky
Jokes | Bean
this my view model
public class BookViewModel
{
[DataMember]
public int IdBook { get; set; }
[DataMember]
[DisplayName("type Book")]
public string typeBook { get; set; }
[DataMember]
[DisplayName("book Name")]
[Required]
public string bookName { get; set; }
}
for select to database i use linq Exp
Expression<Func<Book, bool>> criteria = c => c.IdBook == (int)IdBook ;
IOrderedEnumerable<BookViewModel> result = this.GetList(criteria).OrderBy(o => o.typeBook);
return result.ToList<BookViewModel>();
can anyone have idea for this?? any reference,sugestion will help.. Thanks !