Example #1
0
        public async Task <Response <OrganizationDTO> > Handle(CreateOrganizationCommand request, CancellationToken cancellationToken)
        {
            // Validations
            if (request.Integrants is null || request.Integrants.Count < 1)
            {
            }

            if (await ValidateIntegrantsAsync(request.Integrants) == false)
            {
                //TODO: Throw error person not registered
                return(Response.Fail <OrganizationDTO>("One or more integrants are not registered yet, please check the status of all of them."));
            }

            var result = await _repository.AddOrganizationAsync(request);

            var response = Response.Ok(new OrganizationDTO(result.Id, result.Name, result.Integrants, result.OrginizedPitz));

            return(response);
        }