private bool updateSettlement(EmployeeDailyBalances record)
 {
     try
     {
         _context.Set <EmployeeDailyBalances>().AddOrUpdate(record);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public void addNewBalance(EmployeeDailyBalances balances)
        {
            //check if the date is already in the table
            int count = _context.employeeDailyBalances.Where(x => DbFunctions.TruncateTime(x.date) == balances.date).Count();

            if (count == 0)
            {
                _context.employeeDailyBalances.Add(balances);
                _context.SaveChanges();
            }
            else
            {
                updateSettlement(balances);
            }
        }