// model
public class orderviewmodel
{
public string OrderNumber { get; set; }
public int Count { get; set; }
}
// BL
public IList<orderviewmodel> Read(string tmpC)
{
try
{
using (var entities = new UrEntities())
{
return entities.Masters.Where(w => w.ContainerNumber.Equals(tmpC)).GroupBy(g => g.OrderNumber)
.Select(s => new orderviewmodel { OrderNumber = s.Key, Count = s.ToList().Count, }).ToList();
}
}
catch (Exception)
{
throw;
}
}