Example #1
0
        public IEnumerable <object> Search(string searchText, bool serieSearch, bool playerSearch, bool teamSearch, bool matchDateSearch, bool ignoreCase)
        {
            IEnumerable <object> result = new List <object>();

            if (!serieSearch && !playerSearch && !teamSearch && !matchDateSearch)
            {
                serieSearch     = true;
                playerSearch    = true;
                teamSearch      = true;
                matchDateSearch = true;
            }

            if (serieSearch)
            {
                IEnumerable <object> serieResult = _serieRepository.GetAll().Where(s => s.Name.Value.Contains(searchText, ignoreCase) ||

                                                                                   _teamRepository.GetAll().Where(t => t.Name.Value.Contains(searchText, ignoreCase))
                                                                                   .Any(t => t.SerieIds.Contains(s.Id))
                                                                                   );
                result = result.Concat(serieResult);
            }

            if (playerSearch)
            {
                IEnumerable <object> playerResult = _playerRepository.GetAll().Where(p => p.FullName.Contains(searchText, ignoreCase) ||
                                                                                     p.DateOfBirth.ToString().Contains(searchText, ignoreCase) ||

                                                                                     _teamRepository.GetAll().Where(t => t.Name.Value.Contains(searchText, ignoreCase))
                                                                                     .Any(t => t.PlayerIds.Contains(p.Id))
                                                                                     );

                result = result.Concat(playerResult);
            }

            if (teamSearch)
            {
                IEnumerable <object> teamResult = _teamRepository.GetAll().Where(t => t.Name.Value.Contains(searchText, ignoreCase) ||
                                                                                 t.HomeArena.Value.Contains(searchText, ignoreCase) ||

                                                                                 _playerRepository.GetAll().Where(p => p.FullName.Contains(searchText, ignoreCase))
                                                                                 .Any(p => p.TeamId == t.Id) ||

                                                                                 _serieRepository.GetAll().Where(s => s.Name.Value.Contains(searchText, ignoreCase))
                                                                                 .Any(s => s.TeamTable.Contains(t.Id))
                                                                                 );
                result = result.Concat(teamResult);
            }

            if (matchDateSearch)
            {
                IEnumerable <object> matchResult = _matchRepository.GetAll().Where(m => m.Date.Value.ToShortDateString().Contains(searchText));
                result = result.Concat(matchResult);
            }

            return(result);
        }
        private static void ListarSeries()
        {
            var series = repository.GetAll().Where(serie => serie.IsRemoved() == false).ToList();

            if (series.Count == 0)
            {
                System.Console.WriteLine("Nenhuma serie cadastrada.");
                return;
            }
            foreach (var serie in series)
            {
                System.Console.WriteLine($"#ID {serie.GetId()} - {serie.GetTitulo()}");
            }
        }
Example #3
0
 public static List <Serie> GetAll()
 {
     try
     {
         List <Serie> result;
         using (var context = new MediaManagerContext())
             using (var repository = new SerieRepository(context))
             {
                 result = repository.GetAll();
             }
         return(result);
     }
     catch (Exception ex)
     {
         throw new MediaManagerException($"Erreur : {ex.Message}", ExceptionReturnType.Error);
     }
 }
Example #4
0
        private static void ListarSerie()
        {
            Console.WriteLine("Listar séries: ");
            var list = repository.GetAll();

            if (list.Count == 0)
            {
                Console.WriteLine("Nenhuma série cadastrada!");
                return;
            }
            foreach (var serie in list)
            {
                var excluido = serie.ReturnExcluido();

                Console.WriteLine("#ID: {0}: - {1} - {2}", serie.ReturnId(), serie.ReturnTitulo(), (excluido ? "* Excluido*" : ""));
            }
        }
        public void GetAllIncludesAllRelationsOfSerie()
        {
            var brand = new Brand();

            var serie = new Series
            {
                Brand = brand
            };

            _sut.Add(serie);

            var series = _sut.GetAll();

            Assert.That(series, Is.Not.Null);

            var serieFromDatabase = series.FirstOrDefault(s => s.Id == serie.Id);

            Assert.That(serieFromDatabase.Brand, Is.EqualTo(brand));
        }
Example #6
0
 public IEnumerable <Serie> GetAll()
 {
     return(_serieRepository.GetAll());
 }