コード例 #1
0
ファイル: StepService.cs プロジェクト: JosephKigin/Armis
        public async Task <int> UpdateStep(int aStepId, StepModel aStepModel)
        {
            var theStepEntityToChange = await Context.Step.SingleOrDefaultAsync(i => i.StepId == aStepId);

            if (theStepEntityToChange == null)
            {
                throw new NullReferenceException("There is currently no Step with that Id in the database.");
            }

            var theNewStepEntity = aStepModel.ToEntity();

            Context.Update(theStepEntityToChange);
            await Context.SaveChangesAsync();

            return(theStepEntityToChange.StepId);
        }
コード例 #2
0
        public async Task <SpecProcessAssignModel> RemoveReviewNeeded(int aSpecId, short aSpecRevId, int anAssignId)
        {
            var specProcessAssignEntity = await Context.SpecProcessAssign.FirstOrDefaultAsync(i => i.SpecId == aSpecId && i.SpecRevId == aSpecRevId && i.SpecAssignId == anAssignId);

            if (specProcessAssignEntity == null)
            {
                throw new Exception("No Spec-Process Assignment was found");
            }

            specProcessAssignEntity.ReviewNeeded = false;

            Context.Update(specProcessAssignEntity);
            await Context.SaveChangesAsync();

            return(specProcessAssignEntity.ToModel());
        }