Esempio n. 1
0
        public IActionResult Index(int?GeneId, string atccode)
        {
            if (GeneId == null && atccode == string.Empty)
            {
                var diplotypes = _diplotypeRepository.GetAllwithGene();

                return(CheckDiplotypes(diplotypes));
            }
            // view list 是route 到這段
            else if (GeneId != null)
            {
                var gene = _geneRepository
                           .GetWithDiplotypes((int)GeneId);

                if (gene.Diplotype.Count() == 0)
                {
                    return(View("GeneEmpty", gene));
                }
                else
                {
                    return(View(gene.Diplotype));
                }
            }
            else if (atccode != string.Empty)
            {
                var drug = _diplotypeRepository
                           .FindWithDrugInfo(atccode);
                return(View(drug));
            }
            else
            {
                // throw exception
                throw new ArgumentException();
            }
        }
Esempio n. 2
0
        public IActionResult Index(string atccode)
        {
            var DrugGeneVM = new List <DrugGeneViewModel>();
            // 可以用一個像是view model的東西把他們給combine起來

            IEnumerable <Diplotype> drugGenes = _diplotypeRepository.FindWithDrugInfo(atccode);



            if (drugGenes.Count() == 0)
            {
                return(View("Empty"));
            }

            foreach (var drugGene in drugGenes)
            {
                DrugGeneVM.Add(new DrugGeneViewModel
                {
                    GeneName  = _geneRepository.GetById(drugGene.GeneId).GeneName,
                    Diplotype = drugGene
                });
            }
            return(View(DrugGeneVM));
        }