コード例 #1
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));
        }
コード例 #2
0
ファイル: GroupController.cs プロジェクト: woshisunzewei/EIP
        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));
        }