public async Task <ActionResult> SetOnWatchList([FromBody] SetOnWatchList setOnWatchList)
        {
            var accountItemRepository = new AccountItemRepository();
            var accountItems          = await accountItemRepository.ReadFromFile("stocks.json");

            foreach (var accountItem in accountItems.Where(x => x.Symbol == setOnWatchList.Symbol))
            {
                accountItem.IsOnWatchList = setOnWatchList.IsOnWatchList;
            }
            await accountItemRepository.WriteToFileAsync(accountItems, "stocks.json");

            return(Ok(true));
        }
        public async Task <ActionResult> CurrentAccountItems()
        {
            var accountItemRepository       = new AccountItemRepository();
            var dailyStockDataService       = new CurrentStockDataService();
            var stopQuoteCalculationService = new StopQuoteCalcuationService();
            var accountItems = await accountItemRepository.ReadFromFile("stocks.json");

            var currentStockItems = await dailyStockDataService.GetDailyInformationForShareAsync(accountItems);

            stopQuoteCalculationService.UpdateStopQuotes(currentStockItems);
            if (currentStockItems.SelectMany(x => x.AccountItems).Any(x => x.HasChanged))
            {
                await accountItemRepository.WriteToFileAsync(currentStockItems.SelectMany(x => x.AccountItems), "stocks.json");
            }

            return(Ok(currentStockItems.OrderByDescending(x => x.DailyChangeInPercent)));
        }
        public async Task <ActionResult> NewAccountItem([FromBody] NewAccountItem newAccountItem)
        {
            var accountItemRepository = new AccountItemRepository();
            var accountItems          = await accountItemRepository.ReadFromFile("stocks.json");

            var accountItem = new AccountItem
            {
                BuyingDate    = newAccountItem.BuyingDate,
                BuyingRate    = newAccountItem.BuyingRate,
                Name          = newAccountItem.StockName,
                Symbol        = newAccountItem.StockSymbol,
                StopRate      = newAccountItem.StopRate,
                IsOnWatchList = newAccountItem.IsOnWatchList
            };
            var accountItemList = accountItems.ToList();

            accountItemList.Add(accountItem);
            await accountItemRepository.WriteToFileAsync(accountItemList, "stocks.json");

            return(Ok(true));
        }