Example #1
0
        public IQueryable <Gene> Get()
        {
            var currentPrincipal = identityStorage.GetPrincipal();
            var entities         = unitOfWork.GetAll <Gene>().Where(x => x.UserId == currentPrincipal.UserId);

            return(entities);
        }
Example #2
0
        public User GetCurrentUser()
        {
            var  currentPrincipal = identityStorage.GetPrincipal();
            User currentUser      = unitOfWork.GetById <User>(currentPrincipal.UserId);

            return(currentUser);
        }
Example #3
0
        public async Task <IEnumerable <SynthesisCycleItemViewModel> > GetSynthesisCycles()
        {
            var currentPrincipal = identityStorage.GetPrincipal();
            IEnumerable <SynthesisCycle> allCycles = await unitOfWork.GetAll <SynthesisCycle>()
                                                     .Include(x => x.CycleSteps)
                                                     .Where(x => x.UserId == currentPrincipal.UserId)
                                                     .ToListAsync();

            IList <SynthesisCycleItemViewModel> allCycleItems = new List <SynthesisCycleItemViewModel>();

            foreach (SynthesisCycle synthesisCycle in allCycles.OrderByDescending(x => x.CreatedAt))
            {
                int totalSteps = synthesisCycle.CycleSteps.Count();
                int totalTime  = synthesisCycle.CycleSteps.Sum(x => x.StepTime);
                allCycleItems.Add(new SynthesisCycleItemViewModel()
                {
                    Id = synthesisCycle.Id, Name = synthesisCycle.Name, TotalSteps = totalSteps, TotalTime = totalTime
                });
            }

            return(allCycleItems);
        }
Example #4
0
        private Gene CreateGene(string name, string dnaSequence, string organismId, float kPlusConcentration, float dmso)
        {
            var  currentPrincipal = identityStorage.GetPrincipal();
            User currentUser      = unitOfWork.GetById <User>(currentPrincipal.UserId);

            Organism organism = unitOfWork.GetById <Organism>(organismId);

            Gene gene = new Gene();

            gene.Name               = name;
            gene.DNASequence        = dnaSequence;
            gene.OrganismId         = organism.Id;
            gene.Organism           = organism;
            gene.KPlusConcentration = kPlusConcentration;
            gene.DMSO               = dmso;
            gene.UserId             = currentUser.Id;
            gene.User               = currentUser;

            gene = unitOfWork.InsertOrUpdate(gene);

            unitOfWork.Commit();

            return(gene);
        }
Example #5
0
        public IQueryable <Katastralgemeinden> Get()
        {
            IIndireKatPrincipal indireKatPrincipal = identityStorage.GetPrincipal();

            var comunityIds = UnitOfWork.GetAll <UserGroup>()
                              .Where(group => group.Id == indireKatPrincipal.GroupId)
                              .SelectMany(group => group.Tbl_Group_Communities).Select(comunity => comunity.GKZ).ToList();

            IQueryable <Katastralgemeinden> result = null;

            if (comunityIds.Any())
            {
                result = UnitOfWork.GetAll <Katastralgemeinden>().Where(company => comunityIds.Contains(company.GKZ));
            }

            return(result);
        }