public JsonNetResult GetExpenseSubCategories(int category) { return(new JsonNetResult(_subCategoryRepository.GetAll() .Where(x => x.Category.Id == category) .ToArray() .Select(x => new { x.Id, x.Name, x.Description, Amount = _expenseRepository.GetAll().Count(c => c.SubCategory.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) })); }
public ActionResult Index() { ViewBag.Sources = _SourceRep.GetAll(); try { if (Request["date"] != null) { if (Request["source"] != null && Int32.Parse(Request["source"]) != 0) { return(View(_rep.GetByDateAndSource(Int32.Parse(Request["source"]), DateTime.Parse(Request["date"])))); } else { return(View(_rep.GetByDate(DateTime.Parse(Request["date"])))); } } } catch (Exception e) { } return(View(_rep.GetAll())); }
public List <Expense> GetAll() { return(_expenseRepository.GetAll()); }
public IEnumerable <Expense> Get() { return(ExpenseRepository.GetAll()); }
public IEnumerable <Expense> LoadAll() { return(_repository.GetAll()); }
// GET: Expenses public ActionResult Index() { return(View(expenseRepository.GetAll())); }