コード例 #1
0
ファイル: ExperimentController.cs プロジェクト: trwq63/med656
        // GET: Experiment
        /// <summary>
        /// Display the view for the experiment administrator to view the experiments
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ApplicationUserManager manager = Request.GetOwinContext().GetUserManager<ApplicationUserManager>();

            ViewAllExperimentsViewModel model = new ViewAllExperimentsViewModel();
            model.Experiments = new List<Experiment>();
            model.Experiments.AddRange(_experimentService.GetExperiments(manager.FindByName(User.Identity.Name).ExperimentAdministratorId));
            model.ExperimentCriteria = new List<ExperimentViewModel>();

            // Get all of the experiments parsed data
            for (int i = 0; i < model.Experiments.Count; i++)
            {
                ExperimentViewModel temp = JsonConvert.DeserializeObject<ExperimentViewModel>(model.Experiments.ElementAt(i).QueryString);
                model.ExperimentCriteria.Add(temp);
            }

            return View(model);
        }
コード例 #2
0
ファイル: PhysicianController.cs プロジェクト: trwq63/med656
        /// <summary>
        /// Displays the view for all of the experiments in the system
        /// </summary>
        /// <returns></returns>
        public ActionResult ViewExperiments()
        {
            ViewAllExperimentsViewModel model = new ViewAllExperimentsViewModel();
            model.Experiments = new List<Experiment>();
            model.ExperimentCriteria = new List<ExperimentViewModel>();

            try
            {
                List<Experiment> experiments = _experimentService.GetAllExperiments().ToList();
                model.Experiments.AddRange(experiments);
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
            }

            foreach (Experiment exp in model.Experiments)
            {
                model.ExperimentCriteria.Add(JsonConvert.DeserializeObject<ExperimentViewModel>(exp.QueryString));
            }
            return View(model);
        }