public JsonNetResult GetExpenseCategories() { return(new JsonNetResult(_categoryRepository.GetAll() .ToArray() .Select(x => new { x.Id, x.Name, x.Description, Amount = _subCategoryRepository.GetAll().Count(s => s.Category.Id == x.Id) }) .OrderBy(x => x.Name))); }
public JsonNetResult GetData(int months = 0) { var categories = _categoryRepository.GetAll().OrderBy(x => x.Name).ToList(); var gridList = new List <Dictionary <String, Object> >(); var chartsData = new Dictionary <String, List <double[]> >(); DateTime start; if (months == 0) { var first = _expenseRepository.GetAll().OrderBy(x => x.Date).FirstOrDefault(); if (first == null) { return(new JsonNetResult()); } start = first.Date.Date; } else { start = DateTime.Now.Date.AddMonths(-months); } var now = DateTime.Now.Date; foreach (var category in categories) { chartsData[category.Name] = new List <double[]>(); } var gridLineId = 0; for (var month = now; !(month.Month == start.Month && month.Year == start.Year); month = month.AddMonths(-1)) { gridList.Add(CreateMonthLine(month, categories, chartsData, ref gridLineId)); } return(new JsonNetResult( new { titles = CreateGridTitles(categories), grid = gridList, chart = CreateChartData(chartsData) })); }
/// <summary> /// Loads all the Expense Categories from the cache /// </summary> /// <returns>All the Expense Categories as they are in the cache in generic-based /// list /// </returns> public IEnumerable <Category> GetAll() { return(_repository.GetAll()); }
/// <summary> /// Loads all the Expense Categories from the cache /// </summary> /// <returns>All the Expense Categories as they are in the cache in generic-based /// list /// </returns> public IEnumerable <DataClasses.Category> GetAll() { return(_repository.GetAll()); }
public List <ExpenseCategory> GetAll() { return(_expenseCategoryRepository.GetAll()); }