public async Task MoveAsync(long id, long?parentId)
        {
            var entity = await EntityRepo.GetAsync(id);

            if (entity.ParentId == parentId)
            {
                return;
            }

            //查询当前的子项内容
            var children = await FindChildrenAsync(id, true);

            //保存当前的Code码
            var oldCode = entity.Code;

            //移动课程分类
            entity.Code = await GetNextChildCodeAsync(parentId);

            entity.ParentId = parentId;

            await ValidateCourseCategoryAsync(entity);

            //更新子项的编码
            foreach (var child in children)
            {
                child.Code = OrganizationUnit.AppendCode(entity.Code, OrganizationUnit.GetRelativeCode(child.Code, oldCode));
            }
        }
Exemplo n.º 2
0
        public async Task ChangeStatus(Guid orderId, OrderStatusEnum orderStatus)
        {
            var entity = await EntityRepo.GetAsync(orderId);


            entity.Status = orderStatus;

            await EntityRepo.UpdateAsync(entity);
        }
        public async Task <CourseCategory> FindByIdAsync(long id)
        {
            var entity = await EntityRepo.GetAsync(id);

            return(entity);
        }
 /// <summary>
 /// 获取课程分类编码
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 protected virtual async Task <string> GetCodeAsync(long id)
 {
     return((await EntityRepo.GetAsync(id)).Code);
 }