Exemplo n.º 1
0
        public ActivityDTO GetActivity(int activityId)
        {
            Activity activity = _activityRepository.FindSingle(
                d => d.Id.Equals(activityId),
                new List <string>()
            {
                "Datasets.Template"
            }
                );

            ActivityDTO activityDTO = new ActivityDTO();

            activityDTO.Name      = activity.Name;
            activityDTO.Id        = activity.Id;
            activityDTO.ProjectId = activity.ProjectId;
            if (activity.GetType() == typeof(Assay))
            {
                activityDTO.isAssay = true;
            }

            foreach (var ds in activity.Datasets)
            {
                DatasetDTO dst = _datasetService.GetActivityDatasetDTO(ds.Id);
                activityDTO.datasets.Add(dst);
            }
            return(activityDTO);
        }
Exemplo n.º 2
0
        /**
         * Assay Methods
         * */

        public AssayDTO GetAssay(int assayId)
        {
            var assay = _assayRepository.FindSingle(
                d => d.Id.Equals(assayId),
                new List <string>()
            {
                "Datasets.Template",
                "TechnologyType",
                "TechnologyPlatform",
                "MeasurementType",
                "DesignType"
            }
                );

            var assayDTO = new AssayDTO();

            assayDTO.Name      = assay.Name;
            assayDTO.Id        = assay.Id;
            assayDTO.ProjectId = assay.ProjectId;

            assayDTO.Type       = assay.MeasurementType?.Id;
            assayDTO.Technology = assay.TechnologyType?.Id;
            assayDTO.Platform   = assay.TechnologyPlatform?.Id;
            assayDTO.Design     = assay.DesignType?.Id;


            foreach (var dst in assay.Datasets.Select(ds => _datasetService.GetActivityDatasetDTO(ds.Id)))
            {
                //TODO: convert to enums or CVterms
                if (dst.Class == "Assay Samples")
                {
                    assayDTO.SamplesDataset = dst;
                }
                if (dst.Class == "Assay Observations")
                {
                    assayDTO.ObservationsDataset = dst;
                }
                if (dst.Class == "Assay Features")
                {
                    assayDTO.FeaturesDataset = dst;
                }
            }
            return(assayDTO);
        }