public List <GroupBonus_Result> GroupBonus(int memberId) { List <GroupBonus_Result> result = new List <GroupBonus_Result>(); using (GBHODBEntities db = new GBHODBEntities()) { var bonus = db.GroupBonus(memberId); if (bonus != null) { result.AddRange(bonus); } } return(result); }
public decimal GetTotalGroupBonus(int memberId) { decimal result = 0; using (GBHODBEntities db = new GBHODBEntities()) { var bonus = (from x in db.GroupBonus(memberId) select x); if (bonus != null || bonus.Count() > 0) { result = bonus.Sum(x => x.Pts + x.P1 + x.P2 + x.P3 + x.P4 + x.P5 + x.P6 + x.P7); } } return(result); }