- var getData = await _context.WOMains.Where(s => s.OrgID == orgid).Select(s => s.WOType).ToListAsync();
- foreach (var item in getData)
- {
- WOMainChart = getData.Select(a => new WOChart
- {
- ChartData = item,
- ChartValue = item.Count()
- }).ToList();
- }
In the table I have three disting WOType, each added only one time, so 3 rows in total. However, when I run the query I get 22 as a count for each. What am I doing wrong?