Example #1
0
        public async Task <List <AnunciosDTO> > ListarAnunciosDeUnAnunciante(Anuncios anuncioParaListar)
        {
            using (SportsGoEntities context = new SportsGoEntities(false))
            {
                AnunciantesRepository anuncianteRepo            = new AnunciantesRepository(context);
                List <AnunciosDTO>    listarInformacionAnuncios = await anuncianteRepo.ListarAnunciosDeUnAnunciante(anuncioParaListar);

                if (listarInformacionAnuncios != null && listarInformacionAnuncios.Count > 0)
                {
                    DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable();
                    foreach (var anuncios in listarInformacionAnuncios)
                    {
                        anuncios.Creacion    = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.Creacion);
                        anuncios.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.FechaInicio);

                        if (anuncios.Vencimiento.HasValue)
                        {
                            anuncios.Vencimiento = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaListar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncios.Vencimiento.Value);
                        }
                    }
                }

                return(listarInformacionAnuncios);
            }
        }