コード例 #1
0
        public ActionResult Index()
        {
            var view = new RequestProfileViewModel();

            view.Birthday        = new DateTime(1981, 04, 29);
            view.SelectedCountry = "Mexico";
            view.Countries       = CountryCatalog.GetCountryList();
            view.Gender          = GenderType.Male;
            return(View(view));
        }
コード例 #2
0
        public ActionResult Index(RequestProfileViewModel view)
        {
            string            csvProfilesPath = Server.MapPath(@"bin\MortalityProfiles.csv");
            MortalityReporter reporter        = new MortalityReporter(new TimeProvider(), csvProfilesPath);
            LifeReport        report          = reporter.GetLifeReport(view.Birthday.Value, view.Gender.Value, view.SelectedCountry);

            ViewProfileViewModel responseView = new ViewProfileViewModel(view);

            responseView.Countries           = CountryCatalog.GetCountryList();
            responseView.Messsage            = MortalityReporter.FormatMessage(report);
            responseView.LifeExpectancyGraph = CreateExpectancyGraph(report.WeeksLived, report.ExpectedWeeks);
            return(this.View("Report", responseView));
        }