public virtual ActionResult ByCategoryInTime(string budgetId, string From, string To, string GroupBy)
        {
            DateTime? from = null;
            DateTime? to = null;

            if (From != null)
                from = DateTime.Parse(From);
            if (To != null)
                to = DateTime.Parse(To);

            GroupBy groupBy = MyBudget.Web.AspNet.Controllers.GroupBy.Year;

            try
            {
                groupBy = (GroupBy)Enum.Parse(typeof(GroupBy), GroupBy);
            }
            catch { }

            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 BudgetStatsByCategoryInTimeViewModel(categories, lines, budgetId, "NA", from, to, groupBy);

            return View(model);
        }
        public virtual ActionResult ByCategoryInTime(string budgetId, string From, string To, string GroupBy)
        {
            DateTime?from = null;
            DateTime?to   = null;

            if (From != null)
            {
                from = DateTime.Parse(From);
            }
            if (To != null)
            {
                to = DateTime.Parse(To);
            }

            GroupBy groupBy = MyBudget.Web.AspNet.Controllers.GroupBy.Year;

            try
            {
                groupBy = (GroupBy)Enum.Parse(typeof(GroupBy), GroupBy);
            }
            catch { }

            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 BudgetStatsByCategoryInTimeViewModel(categories, lines, budgetId, "NA", from, to, groupBy);

            return(View(model));
        }