I want to create global function, but I have an error in mycode like this :
public static GetTotalResearchByArea()
{
var listOfStrings = new List<int>();
var all_area = context.Areas.Select(x => x.Id ).ToList();
foreach( var item in all_area)
{
var allReserachCategory = context.ResearchCategories
.Where(a => a.AreaId == item)
.Select(a => a.Id).ToList();
var totalResearchBySingleArea = context.Researchs
.Where(c => allReserachCategory.Contains(c.ResearchCategoryId)).Count();
listOfStrings.Add(totalResearchBySingleArea);
}
return listOfStrings;
}
what should it be ?
> GetTotalResearchByArea()` and then `return Task.FromResult(listOfStrings);`. It could also just return a `List` straight on - `public static List GetTotalResearchByArea`.
– jwweiler Jan 17 '19 at 07:43