Ejemplo n.º 1
0
        public string Add(OrganizationNewDto organization, string userId)
        {
            string id  = Guid.NewGuid().ToString();
            var    org = new Organization(id, organization.Name, organization.Desc, organization.Address, organization.Mobile, organization.ParentId, organization.IsEnabled);

            org.AddUser(userId);
            _orgRepo.Add(org);

            return(id);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> AddOrganization(OrganizationNewDto organization)
        {
            string userId = User.FindFirst(JwtClaimTypes.Subject)?.Value;

            if (String.IsNullOrWhiteSpace(userId))
            {
                throw new IamException(HttpStatusCode.BadRequest, "用户没有登陆!");
            }

            string id = _orgService.Add(organization, userId);

            return(CreatedAtAction(nameof(GetOrganizationById), new
            {
                Id = id
            }));
        }