public IList <TurnTeamDto> GetPublicIncompletedReserveList(int campId, string email) { try { Perfil perfil = perfilRepository.Exists(email); Helper.ThrowIfNull(perfil, "Perfil inválido"); IList <TurnTeamDto> turnTeams = new List <TurnTeamDto>(); DateTime dateTime = Helper.GetDateTimeZone(); dateTime = dateTime.AddHours((int)ETurnsExpiration.HOURS); var turns = turnRepository.PublicIncompletedRequestList(campId, perfil.Id, dateTime); foreach (Turn turn in turns) { Hour hour = turn.Hour; Camp camp = hour.Camp; Team team = turn.Team; DateTime timestamp = new DateTime(turn.Date.Year, turn.Date.Month, turn.Date.Day, hour.Time.Hours, hour.Time.Minutes, hour.Time.Seconds); int playersAmount = team.Players.Where(p => p.ConfirmDate.HasValue).Count(); TurnTeamDto turnTeamDto = new TurnTeamDto(turn.Id, team.Name, camp.Name, camp.Street + " " + camp.Number, timestamp, playersAmount); turnTeams.Add(turnTeamDto); } return(turnTeams); } catch { throw; } }
public IList <TurnTeamDto> ListByBufferZone(double longitude, double latitude, float radius) { try { IList <TurnTeamDto> turnTeams = new List <TurnTeamDto>(); DateTime dateTime = Helper.GetDateTimeZone(); dateTime = dateTime.AddHours((int)ETurnsExpiration.HOURS); var turns = turnRepository.ListByBufferZone(longitude, latitude, radius, dateTime); foreach (Turn turn in turns) { Hour hour = turn.Hour; Camp camp = hour.Camp; Team team = turn.Team; DateTime timestamp = new DateTime(turn.Date.Year, turn.Date.Month, turn.Date.Day, hour.Time.Hours, hour.Time.Minutes, hour.Time.Seconds); int playersAmount = team.Players.Where(p => p.ConfirmDate.HasValue).Count(); TurnTeamDto turnTeamDto = new TurnTeamDto(turn.Id, team.Name, camp.Name, camp.Street + " " + camp.Number, timestamp, playersAmount); turnTeams.Add(turnTeamDto); } return(turnTeams); } catch { throw; } }