示例#1
0
        public ActionResult Detail(int?filterId, string filter)
        {
            Genotype genotypeSearched      = null;
            SelectionSummaryViewModel ssvm = null;

            int genusId = SessionManager.GetGenusId().Value;

            if (!filterId.HasValue && !filter.IsNullOrWhiteSpace())
            {
                var genotypesResult = m_repo.GetGenotypes(filter, genusId, 2);
                if (genotypesResult.Count() == 1)
                {
                    genotypeSearched = genotypesResult.First();
                }
            }
            else if (filterId.HasValue)
            {
                genotypeSearched = m_repo.GetGenotype(filterId.Value);
            }

            if (genotypeSearched != null)
            {
                ssvm = s_repo.GetSelectionSummary(genotypeSearched.Id);
            }

            if (ssvm == null)
            {
                return(RedirectToAction("Index", new { filter = filter }));
            }
            ViewBag.GenusId = genusId;

            ViewBag.FlatTypes = new SelectList(m_repo.GetFlatTypes(), "Id", "Name");
            return(View(ssvm));
        }
        public SelectionSummaryViewModel GetSelectionSummary(int id)
        {
            Genotype                         genotype = u_repo.GetGenotype(id);
            IEnumerable <Family>             families = u_repo.GetQueryableFamilies(t => t.MaleParent == genotype.Id || t.FemaleParent == genotype.Id).ToList();
            IEnumerable <FamilyUseViewModel> fuvms    = families.ToFamilyUseViewModel(genotype);
            PhenotypeEntryViewModel          pdvm     = GetPhenotypeEntry(id);
            SelectionSummaryViewModel        ssvm     = genotype.ToSelectionSummaryViewModel(pdvm, fuvms);

            return(ssvm);
        }
示例#3
0
        /// <summary>
        /// Displays selection summary detail view for given genotype.
        /// </summary>
        /// <param name="id">
        /// Id of genotype to display selection summary for.
        /// </param>
        /// <returns>
        /// Detail view for selection summary.
        /// </returns>
        public ActionResult Detail(int?id)
        {
            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            SelectionSummaryViewModel ssvm = s_repo.GetSelectionSummary(id.Value);

            if (ssvm == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GenusId   = m_repo.GetGenotype(id.Value).Family.GenusId;
            ViewBag.FlatTypes = new SelectList(m_repo.GetFlatTypes(), "Id", "Label");
            return(View(ssvm));
        }