0

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?

1 Answer 1

1
var queryDetails = DbContext.ProductEventNotificationDetails
    .GroupBy(x => x.NotificationMethod)
    .Select(group => group.Key);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.