public virtual ActionResult ByCategory(string budgetId, string From, string To) { DateTime?from = null; DateTime?to = null; if (From != null) { from = DateTime.Parse(From); } if (To != null) { to = DateTime.Parse(To); } var projection = ProjectionManager.GetBudgetLinesProjection(budgetId); IEnumerable <BudgetLine> lines = projection.GetAllLinesBetween(from, to); if (from == null) { from = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MinValue).Min(r => r.Date.Date); } if (to == null) { to = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MaxValue).Max(r => r.Date.Date); } var categories = ProjectionManager.GetCategories().GetBudgetsCategories(budgetId); var model = new BudgetStatsByCategoryViewModel(categories, lines, budgetId, "NA", from, to); return(View(model)); }
public virtual ActionResult ByCategory(string budgetId, string From, string To) { DateTime? from = null; DateTime? to = null; if (From != null) from = DateTime.Parse(From); if (To != null) to = DateTime.Parse(To); var projection = ProjectionManager.GetBudgetLinesProjection(budgetId); IEnumerable<BudgetLine> lines = projection.GetAllLinesBetween(from, to); if (from == null) from = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MinValue).Min(r => r.Date.Date); if (to == null) to = lines.Select(s => s.Date).DefaultIfEmpty(DateTime.MaxValue).Max(r => r.Date.Date); var categories = ProjectionManager.GetCategories().GetBudgetsCategories(budgetId); var model = new BudgetStatsByCategoryViewModel(categories, lines, budgetId, "NA", from, to); return View(model); }