public List <Earnings> RunBarTeamCheckout(DateTime shiftDate, string lunchOrDinner, int barBackCount) { TeamEntity barTeam = _teamRepository.GetBarTeamForShift(shiftDate, lunchOrDinner); BarTeam team = Mapper.Map <BarTeam>(barTeam); List <CheckoutEntity> checkouts = _checkoutRepository.GetCheckoutsForATeam(team.Id).ToList(); foreach (CheckoutEntity c in checkouts) { Checkout chkout = Mapper.Map <Checkout>(c); team.Checkouts.Add(chkout); } List <TipOutEntity> serverTipOuts = _teamRepository.GetTipOuts(shiftDate, lunchOrDinner, "server"); decimal serverTips = 0; foreach (TipOutEntity t in serverTipOuts) { serverTips += t.BarTipOut; } if (team.CheckoutHasBeenRun == true) { _teamRepository.DeleteTipOut(team.Id); } List <Earnings> teamEarnings = team.RunBarCheckout(serverTips, barBackCount); TipOutEntity tipoutEntity = Mapper.Map <TipOutEntity>(team.TipOut); tipoutEntity.Team = barTeam; _teamRepository.AddTipOut(tipoutEntity); return(teamEarnings); }
public IEnumerable <CheckoutEntity> GetCheckoutEntitiesForATeam(int teamId) { return(_repository.GetCheckoutsForATeam(teamId)); }