public class Bar
{
[Key]
public int BarID { get; set; }
public int Quantity { get; set; }
public decimal UnitTotal { get; set; }
public decimal? DailyTotal { get; set; }
public int PricelistID { get; set; }
public virtual Pricelist Pricelist { get; set; }
}
//in the BarController Create method
bar.DailyTotal = db.Bars.Sum(x => x.UnitTotal);
答案 0 :(得分:0)
建议您在数据库的df %>%
gather(variable, value, -(month:student)) %>%
unite(temp, student, variable) %>%
spread(temp, value)
# month Amy_A Amy_B Bob_A Bob_B
# 1 1 9 6 8 5
# 2 2 7 7 6 6
# 3 3 6 8 9 7
列中显示空值。您可以消除null或将类型更改为UnitTotal