Sorry I'm just learning to use C#, How do I create a grouping function using async ? I want to add up the contract values, I tried with code like this
public async Task <IEnumerable<BudgetingData>> GetTotalBudgeting()
{
var result = await _context.Budgetings
.Include(e => e.ProposalBudgeting)
.Include(e => e.ProposalBudgeting.Division)
.GroupBy(e => e.ContractValue)
.AsNoTracking()
.ToListAsync();
return result;
}
Budgeting Data
public class BudgetingData
{
[Key]
public int Id { get; set; }
public int? ProposalBudgetingId { get; set; }
public string SubBudgetingProject { get; set; }
public string ValueProjectEstimation { get; set; }
public string CurrentYearAllocation { get; set; }
public string Procurement { get; set; }
public string StatusProject { get; set; }
public string ContractValue { get; set; }
public string LstYear_Realization { get; set; }
public string LstYear_RemainingPayment { get; set; }
public string ThsYear_TotalPayment { get; set; }
public string ThsYear_RemainingPayment { get; set; }
public DateTime LastUpdate_dt { get; set; }
public int? StatusId { get; set; }
public string IsDelete { get; set; }
public virtual Status Status { get; set; }
public virtual ProposalBudgeting ProposalBudgeting { get; set; }
}
I want to total the contract value of the divisions, for example division 1 has a total contract value of 1000
However, when the error returns result, the error is "Cannot implicitly convert type 'type' 1 'type 2'. An explicit conversion exists (are you missing a cast?)"