public ActionResult Dashboard(string id)
        {
            if (id == null)
            {
                id = User.Identity.GetUserId();
            }
            Account user = logic.Get(id);
            PersonalDashboardViewModel model = GenerateViewModel(user);

            return(View(model));
        }
        public PersonalDashboardViewModel GenerateViewModel(Account a)
        {
            PersonalDashboardViewModel pdvm = new PersonalDashboardViewModel();

            pdvm.Id            = a.Id;
            pdvm.FullName      = a.FullName;
            pdvm.PreferredName = a.PreferredName;
            pdvm.GoalCSV       = GoalsCSV(a);
            string[] TwoDay = TwoDayActivityCSV(a);
            pdvm.TwoDayCSV = TwoDay[0];
            pdvm.ReportCSV = ReportCSV(a);
            string[] pie = TotalActivityCSV(a);
            pdvm.TotalCSV         = pie[0];
            pdvm.BarchartInsight  = TwoDay[1];
            pdvm.Closest          = GoalInsight(a);
            pdvm.LinechartInsight = ReportInsight(a);
            pdvm.PiechartInsight  = pie[1];
            pdvm.Prediction       = MovingAverageDistance(a);
            pdvm.CanShare         = a.Id == User.Identity.GetUserId();
            return(pdvm);
        }