public CircleGetOutputData Handle(CircleGetInputData inputData)
        {
            var id     = new CircleId(inputData.Id);
            var circle = circleRepository.Find(id);

            var data = new CircleData(
                circle.Id.Value,
                circle.Name.Value,
                circle.Owner?.Value,
                circle.Members.Select(x => x.Value).ToList()
                );

            return(new CircleGetOutputData(data));
        }
Exemple #2
0
        public CircleGetResponseModel Get(string id)
        {
            var getCircleCommand = new CircleGetInputData(id);
            var getCircleResult  = bus.Handle(getCircleCommand);

            var circle = new CircleResponseModel(getCircleResult.Circle);

            if (circle.OwnerId == null)
            {
                return(new CircleGetResponseModel(circle, new UserResponseModel("", "")));
            }

            var getOwnerCommand = new UserGetInputData(circle.OwnerId);
            var getOwnerResult  = bus.Handle(getOwnerCommand);

            var owner = new UserResponseModel(getOwnerResult.User);

            return(new CircleGetResponseModel(circle, owner));
        }