Reputation: 225
I wrote this query:
var queryDetails = DbContext.ProductEventNotificationDetails.Where(p
=>p.ProductEventNotifications_Id == ID).ToList().Select(r => new
{
r.Id,
NotificationMethod =
r.NotificationContact.NotificationMethod.Name
});
So, i need to get only distinct values based on NotificationMethod value. If I use distinct() at the end, it schedules according to Id. Can you please let me know how to accomplish this?
Upvotes: 0
Views: 677
Reputation: 29120
var queryDetails = DbContext.ProductEventNotificationDetails
.GroupBy(x => x.NotificationMethod)
.Select(group => group.Key);
Upvotes: 1