private void ComputeCommissions()
        {
            List <SalesPerson> employees = _context.SalesPeople.Include(sp => sp.Sales).ToList();

            foreach (SalesPerson employee in employees)
            {
                employee.Commission = 0;
                foreach (Sale sale in employee.Sales)
                {
                    employee.Commission += sale.Amount * (decimal)0.1;
                }
            }
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
 public void Add(T obj)
 {
     dbContext.Set <T>().Add(obj);
     dbContext.SaveChanges();
 }