public UserGetResponseModel Get(string id) { var inputData = new UserGetInputData(id); var outputData = bus.Handle(inputData); var userModel = new UserResponseModel(outputData.User); return(new UserGetResponseModel(userModel)); }
public UserGetOutputData Handle(UserGetInputData inputData) { var id = new UserId(inputData.Id); var user = userRepository.Find(id); if (user == null) { throw new UserNotFoundException(id, "사용자를 찾지 못했음"); } var data = new UserData(user.Id.Value, user.Name.Value); return(new UserGetOutputData(data)); }
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)); }