asp.net mvc 4 - In a column of Credits, show the amount of credits for all courses for which student enlisted -



asp.net mvc 4 - In a column of Credits, show the amount of credits for all courses for which student enlisted -

how in column of credits show amount of credits courses pupil enlisted.

i need modify contoso university app.

view:

@model pagedlist.ipagedlist<contosouniversity.models.student> @using pagedlist.mvc; <h2>students</h2> <p> @html.actionlink("create new", "create") </p> @using (html.beginform("index", "student", formmethod.get)) { @html.antiforgerytoken() @html.validationsummary(true) <p> find name: @html.textbox("searchstring", viewbag.currentfilter string) <input type="submit" value="filter" /> </p> } <table class="table"> <tr> <th> @html.actionlink("last name", "index", new { sortorder = viewbag.namesortparm }) </th> <th> first name </th> <th> @html.actionlink("enrollment date", "index", new { sortorder = viewbag.datesortparm }) </th> <th> date of birth </th> <th> courses </th> <th> credits </th> <th></th> </tr> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.lastname) </td> <td> @html.displayfor(modelitem => item.firstmidname) </td> <td> @html.displayfor(modelitem => item.enrollmentdate) </td> <td> @html.displayfor(modelitem => item.dateofbirth) </td> <td> @string.join(",", item.enrollments.select(e => e.course.title)) </td> <td> </td> <td> @html.actionlink("edit", "edit", new { id=item.id }) | @html.actionlink("details", "details", new { id=item.id }) | @html.actionlink("delete", "delete", new { id=item.id }) </td> </tr> } </table> <br /> page @(model.pagecount < model.pagenumber ? 0 : model.pagenumber) of @model.pagecount @html.pagedlistpager(model, page => url.action("index", new { page, sortorder = viewbag.currentsort, currentfilter = viewbag.currentfilter }))

please help!

i dont understand how it!

if need more details please tell me.

i don't have experience contoso university, seems me may able sum credits doing this:

item.enrollments.sum(e => e.course.credits);

this untested , it's hard know sure if work without knowing how info structured, i'm sure looking @ sum() method help out.

asp.net-mvc-4

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -