using System.Collections.Generic;
public static void Main()
List<Complaint_Log> sample= new List<Complaint_Log>();
sample.Add(new Complaint_Log {
ContactPerson="Bob Smith"
sample.Add(new Complaint_Log {
ContactPerson="Fred Stevens"
sample.Add(new Complaint_Log {
ContactPerson="Rick Moore"
sample.Add(new Complaint_Log {
ContactPerson="Bob Smith"
var company = from c in sample
group c by c.CompanyName into g
select new CompanyAlertModel()
var contact = from c in sample
group c by c.ContactPerson into g
select new ContactAlertModel()
var x= company.Where(x => x.Occurrence > 1).ToList();
var y=contact.Where(x => x.Occurrence > 1).ToList();
ShowDataViewModel sendToPartial=new ShowDataViewModel();
sendToPartial.companyAlertModel=x;
sendToPartial.contactAlertModel=y;
public class ShowDataViewModel()
public List<ContactAlertModel> contactAlertModel= new List<ContactAlertModel>();
public List<CompanyAlertModel> companyAlertModel= new List<CompanyAlertModel>();
public class CompanyAlertModel
public CompanyAlertModel() { }
public string Customer { get; set; }
public Nullable<int> Occurrence { get; set; }
public Complaint_Log Complaints { get; set; }
public class ContactAlertModel
public ContactAlertModel() { }
public string Customer { get; set; }
public Nullable<int> Occurrence { get; set; }
public Complaint_Log Complaints { get; set; }
public class Complaint_Log
public string CompanyName {get;set;}
public string ContactPerson {get;set;}