コード例 #1
0
        public DbRepository()
        {
            Context      = new Context();
            users        = Context.Users.ToList();
            historyItems = Context.TotalHistory.ToList();
            userBudgets  = Context.UserBudgets.ToList();
            var repo = new RepositoryJson();

            categories = repo.categories;
        }
コード例 #2
0
        public List <Category> SelectOnlyExpenseCategories()
        {
            var             repo = new RepositoryJson();
            List <Category> some = new List <Category>();

            for (int i = 0; i < 7; i++)
            {
                some.Add(repo.categories[i]);
            }
            return(some);
        }
コード例 #3
0
        public void UpdateHistory()
        {
            _repo.historyItems = _repo.Context.TotalHistory.ToList();
            var json = new RepositoryJson();

            foreach (var historyItem in _repo.historyItems)
            {
                if (historyItem.Category == null)
                {
                    historyItem.Category = json.categories.FirstOrDefault(cat => cat.Id == historyItem.CategoryId);
                }
            }
        }