Ejemplo n.º 1
0
        public List <APOD> Get([FromQuery] DateTime APODDate)
        {
            var APODObject = _mongoDBRepository.FindAPODFromDate(AppSetting.Database_Collection, APODDate);

            if (APODObject == null)
            {
                var APODList = JsonConvert.DeserializeObject <APODList>(_service.GetAPOD(APODDate).Result.ToString());
                if (APODList.APODS.Count > 0)
                {
                    _mongoDBRepository.InsertAPOD(AppSetting.Database_Collection, APODList.APODS[0]);
                    APODObject = APODList.APODS[0];
                }
            }
            var listapod = new List <APOD>();

            listapod.Add(APODObject);
            return(listapod);
        }