Пример #1
0
        public async Task <ViewResultBase> Edit(SystemOrganizationInput input)
        {
            var orgOutput = new SystemOrganizationOutput();

            //如果为编辑
            if (!input.Id.IsEmptyGuid())
            {
                var menu = await _organizationLogic.GetByIdAsync(input.Id);

                orgOutput = menu.MapTo <SystemOrganizationOutput>();

                //获取父级信息
                var parentInfo = await _organizationLogic.GetByIdAsync(orgOutput.ParentId);

                if (parentInfo != null)
                {
                    orgOutput.ParentName = parentInfo.Name;
                    orgOutput.ParentCode = parentInfo.Code;
                }
            }
            //新增
            else
            {
                if (!input.ParentId.IsEmptyGuid())
                {
                    var parentInfo = await _organizationLogic.GetByIdAsync(input.ParentId);

                    orgOutput.Code       = parentInfo.Code;
                    orgOutput.ParentId   = input.ParentId;
                    orgOutput.ParentName = parentInfo.Name;
                    orgOutput.ParentCode = parentInfo.Code;
                }
            }
            return(View(orgOutput));
        }
Пример #2
0
        public async Task <JsonResult> GetById(IdInput input)
        {
            var menu = await _organizationLogic.GetByIdAsync(input.Id);

            var orgOutput = menu.MapTo <SystemOrganizationOutput>();
            //获取父级信息
            var parentInfo = await _organizationLogic.GetByIdAsync(orgOutput.ParentId);

            if (parentInfo != null)
            {
                orgOutput.ParentName = parentInfo.Name;
            }
            return(Json(orgOutput));
        }
Пример #3
0
        public async Task <JsonResult> GetById(IdInput input)
        {
            var role = await _roleLogic.GetByIdAsync(input.Id);

            var output = role.MapTo <SystemRoleOutput>();
            var org    = (await _organizationLogic.GetByIdAsync(role.OrganizationId));

            if (org != null)
            {
                output.OrganizationName = org.Name;
            }
            return(Json(output));
        }
Пример #4
0
        public async Task <JsonResult> GetById(IdInput input)
        {
            var group = await _groupLogic.GetByIdAsync(input.Id);

            var output = group.MapTo <SystemGroupOutput>();
            var org    = (await _organizationLogic.GetByIdAsync(group.OrganizationId));

            if (org != null)
            {
                output.OrganizationName = org.Name;
            }
            return(Json(output));
        }
Пример #5
0
        public async Task <ViewResultBase> Edit(SystemGroupEditViewModel viewModel)
        {
            var group = new SystemGroup();

            //如果为编辑
            if (!viewModel.GroupId.IsNullOrEmptyGuid())
            {
                group = await _groupLogic.GetByIdAsync(viewModel.GroupId);

                ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(group.OrganizationId)).Name;
            }
            //新增
            else
            {
                group.CreateTime = DateTime.Now;
                if (!viewModel.OrganizationId.IsNullOrEmptyGuid())
                {
                    viewModel.OrganizationId     = (Guid)viewModel.OrganizationId;
                    ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(viewModel.OrganizationId)).Name;
                }
            }
            return(View(group));
        }
Пример #6
0
        public async Task <ViewResultBase> Edit(SystemRoleEditViewModel viewModel)
        {
            var role = new SystemRole();

            //如果为编辑
            if (!viewModel.RoleId.IsNullOrEmptyGuid())
            {
                role = await _roleLogic.GetByIdAsync(viewModel.RoleId);

                ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(role.OrganizationId)).Name;
            }
            //新增
            else
            {
                role.CreateTime = DateTime.Now;
                if (!viewModel.OrganizationId.IsNullOrEmptyGuid())
                {
                    role.OrganizationId          = (Guid)viewModel.OrganizationId;
                    ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(role.OrganizationId)).Name;
                }
            }
            return(View(role));
        }
Пример #7
0
        public async Task <ViewResultBase> Edit(SystemPostEditViewModel viewModel)
        {
            SystemPost post = new SystemPost();

            //如果为编辑
            if (!viewModel.PostId.IsNullOrEmptyGuid())
            {
                post = await _postLogic.GetByIdAsync(viewModel.PostId);

                ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(post.OrganizationId)).Name;
            }
            //新增
            else
            {
                post.CreateTime = DateTime.Now;
                if (!viewModel.OrganizationId.IsNullOrEmptyGuid())
                {
                    post.OrganizationId          = (Guid)viewModel.OrganizationId;
                    ViewData["OrganizationName"] = (await _organizationLogic.GetByIdAsync(viewModel.OrganizationId)).Name;
                }
            }
            return(View(post));
        }