예제 #1
0
        public async Task <IActionResult> DisableEnableOrganizationAsync([FromBody] DisableEnableOrganizationRequestDto request)
        {
            var organizationBiz = new OrganizationBiz();
            var entity          = await organizationBiz.GetAsync(request.OrgGuid);

            if (entity == null)
            {
                return(Failed(ErrorCode.UserData, "找不到数据"));
            }
            var oall = await organizationBiz.GetListAsync();

            var entitys = GetOrganizationSubset(oall, request.OrgGuid);

            entitys.Add(entity);
            foreach (var item in entitys)
            {
                item.LastUpdatedBy   = UserID;
                item.LastUpdatedDate = DateTime.Now;
                item.Enable          = request.Enable;
            }
            var result = await organizationBiz.UpdateAsync(entitys);

            if (!result)
            {
                return(Failed(ErrorCode.UserData, "修改失败"));
            }
            return(Success());
        }
예제 #2
0
        public async Task <IActionResult> UpdateOrganizationAsync([FromBody] UpdateOrganizationRequestDto request)
        {
            var organizationBiz = new OrganizationBiz();
            var entity          = await organizationBiz.GetAsync(request.OrgGuid);

            if (entity == null)
            {
                return(Failed(ErrorCode.UserData, "找不到数据"));
            }
            entity.LastUpdatedBy   = UserID;
            entity.Enable          = request.Enable;
            entity.LastUpdatedDate = DateTime.Now;
            entity.OrgName         = request.OrgName;
            entity.ParentGuid      = string.IsNullOrWhiteSpace(request.ParentGuid) ? null : request.ParentGuid;
            entity.Sort            = request.Sort;
            var result = await organizationBiz.UpdateAsync(entity);

            if (!result)
            {
                return(Failed(ErrorCode.UserData, "修改失败"));
            }
            return(Success());
        }