Ejemplo n.º 1
0
        public Task CreateQuickStartStepAsync(int productId, int productVersionId, UpdateQuickStartStepModel updateModel)
        {
            var steps = quickStartStepRepository.GetSteps(productVersionId);

            return(quickStartStepRepository.CreateAsync(new QuickStartStep()
            {
                Description = updateModel.Content,
                ProductVersionId = productVersionId,
                Sort = steps.Any() ? steps.Max(x => x.Sort) + 1 : 0,
                Title = updateModel.Title
            }));
        }
Ejemplo n.º 2
0
        public Task UpdateQuickStartStepAsync(UpdateQuickStartStepModel updateModel)
        {
            var step = quickStartStepRepository.QueryByKey(updateModel.Id);

            if (step == null)
            {
                throw new OperationException("该步骤不存在");
            }
            step.Title       = updateModel.Title;
            step.Description = updateModel.Content;
            return(quickStartStepRepository.SaveChangesAsync());
        }