TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
590
1.9k
148.6k
asp.net core How do I implement GroupBy twice?
May 16 2021 5:04 AM
The results of my query are displayed in a selection of div as below
By applying a GroupBy, view below, I managed to hide duplicates in Step No, see in the picture below as well. The questions is, how do I do the same for Activity?
@foreach (
var
group1
in
Model.JSAViewList.GroupBy(s => s.StepNo))
{
<div
class
=
"row no-gutters"
>
<div
class
=
"col-md-1"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>Step No:</label>
</div>
<div
class
=
"col-md-11"
>
<div
class
=
"row no-gutters"
>
<div
class
=
"col-md-3"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>Activity:</label>
</div>
<div
class
=
"col-md-2"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>Hazards:</label>
</div>
<div
class
=
"col-md-2"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>Controls:</label>
</div>
<div
class
=
"col-md-2"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>PPEs:</label>
</div>
<div
class
=
"col-md-2"
>
<label
class
=
"form-control text-white"
style=
"background-color:mediumorchid"
>Responsible:</label>
</div>
</div>
</div>
</div>
<div
class
=
"row no-gutters"
>
<div
class
=
"col-md-1"
>
<span
class
=
"form-control"
>@Html.DisplayFor(model => group1.Key)</span>
</div>
<div
class
=
"col-md-11"
>
@foreach (
var
item
in
group1.OrderBy(s => s.StepNo).ThenBy(s => s.Hazard))
{
<div
class
=
"row no-gutters"
>
<div
class
=
"col-md-3"
>
<span
class
=
"form-control"
>@Html.DisplayFor(modelItem => item.ActivitySec)</span>
</div>
<div
class
=
"col-md-2"
>
<span
class
=
"form-control"
>@Html.DisplayFor(modelItem => item.Hazard)</span>
</div>
<div
class
=
"col-md-2"
>
<span
class
=
"form-control"
>@Html.DisplayFor(modelItem => item.Controls)</span>
</div>
<div
class
=
"col-md-2"
>
<span
class
=
"form-control"
>@Html.DisplayFor(modelItem => item.PPE)</span>
</div>
<div
class
=
"col-md-2"
>
<span
class
=
"form-control"
>@Html.DisplayFor(modelItem => item.Responsible)</span>
</div>
</div>
}
</div>
</div>
}
Reply
Answers (
2
)
Implement One Signal Notification.
json and web api