private async Task <ActionResult <CommandLogDto> > UpdateDb(IApiCalls apiCalls)
        {
            DateTime lastUpdateTime = _repo.GetLatestLog().LastUpdate;

            if (DateTime.Now < lastUpdateTime.AddHours(1))
            {
                return(NoContent());
            }

            _repo.ClearListings();
            IEnumerable <Listing> listingsToAdd = await apiCalls.GetAllListings();

            _repo.AddListings(listingsToAdd);

            CommandLog commandLog = new CommandLog();

            commandLog.Deleted         = (_repo.GetRecipePricesCount() + _repo.GetTpPricesCount());
            commandLog.CommandExecuted = "update";
            commandLog.LastUpdate      = DateTime.Now;
            commandLog.Inserted        = _repo.GetListingsCount();
            _repo.AddCommandLog(commandLog);

            SetAllRecipesCreationPrice();

            if (_repo.SaveChanges())
            {
                //return NotFound();
                CommandLogDto commandLogDto = _mapper.Map <CommandLogDto>(commandLog);
                //TODO: change to add rout in response header
                return(Ok(commandLogDto));
            }

            return(NotFound());
        }
        public ActionResult <CommandLogDto> GetLogById(int id)
        {
            CommandLog commandLog = _repo.GetLogById(id);

            if (commandLog != null)
            {
                CommandLogDto commandLogDto = _mapper.Map <CommandLogDto>(commandLog);
                return(Ok(commandLogDto));
            }
            return(NotFound());
        }
        public ActionResult <CommandLogDto> GetLatestUpdate()
        {
            CommandLog commandLog = _repo.GetLatestLog();

            if (commandLog != null)
            {
                CommandLogDto commandLogDto = _mapper.Map <CommandLogDto>(_repo.GetLatestLog());
                return(Ok(commandLogDto));
            }
            return(NotFound());
        }