111
This commit is contained in:
parent
84eca38131
commit
3e1995bf3d
@ -12,7 +12,7 @@ namespace asg_form.Controllers.Budget
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string budget_year { get; set; }
|
||||
public int budget_money { get; set; }
|
||||
public int budget_money { get; set; } = 0;
|
||||
public string budget_type { get; set; }
|
||||
public string budget_name { get; set; }
|
||||
public string budget_used { get; set; }
|
||||
@ -210,19 +210,20 @@ namespace asg_form.Controllers.Budget
|
||||
{
|
||||
using (var db = new TestDbContext())
|
||||
{
|
||||
var budgetTotals = await db.budgetDetails
|
||||
.GroupBy(b => new
|
||||
{
|
||||
b.source_event_id,
|
||||
b.source_event_name
|
||||
})
|
||||
.Select(g => new
|
||||
{
|
||||
sourceEventId = g.Key.source_event_id,
|
||||
sourceEventName = g.Key.source_event_name,
|
||||
budgetTotalMoney = g.Sum(b => b.budget_money)
|
||||
})
|
||||
.ToListAsync();
|
||||
var budgetTotals = await (from e in db.events
|
||||
join b in db.budgetDetails on e.Id equals b.source_event_id
|
||||
group b by new
|
||||
{
|
||||
e.Id,
|
||||
e.name
|
||||
} into g
|
||||
select new
|
||||
{
|
||||
sourceEventId = g.Key.Id,
|
||||
sourceEventName = g.Key.name,
|
||||
budgetTotalMoney = g.Sum(b => b.budget_money)
|
||||
}).ToListAsync();
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
code = 200,
|
||||
|
Loading…
x
Reference in New Issue
Block a user