Esempio n. 1
0
        public async Task <Anuncios> BuscarAnuncioPorConsecutivo(Anuncios anuncioParaBuscar)
        {
            using (SportsGoEntities context = new SportsGoEntities(false))
            {
                AnunciantesRepository anuncianteRepo = new AnunciantesRepository(context);
                Anuncios anuncioBuscado = await anuncianteRepo.BuscarAnuncioPorConsecutivo(anuncioParaBuscar);

                if (anuncioBuscado != null)
                {
                    DateTimeHelperNoPortable helper = new DateTimeHelperNoPortable();
                    anuncioBuscado.Creacion    = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncioBuscado.Creacion);
                    anuncioBuscado.FechaInicio = helper.ConvertDateTimeFromAnotherTimeZone(anuncioParaBuscar.ZonaHorariaGMTBase, helper.DifferenceBetweenGMTAndLocalTimeZone, anuncioBuscado.FechaInicio);

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

                return(anuncioBuscado);
            }
        }