public void Handle(CreateProduct command)
        {
            var product = new Product(command.ProductId, command.Name, command.Count);

            _DomainRepository.Add(product);
            _UnitOfWork.Commit();
        }
        public void Handle(Register command)
        {
            if (_DomainRepository.Find <Account>(a => a.UserName == command.UserName) != null)
            {
                throw new SysException(DTO.ErrorCode.UsernameAlreadyExists, string.Format("Username {0} exists!", command.UserName));
            }

            Account account = new Account(command.UserName, command.Password, command.Email);

            _DomainRepository.Add(account);
            _UnitOfWork.Commit();
            _CommandContext.Reply = account.ID;
        }
        /// <summary>
        /// Community Event for the creation of any CommunityPage
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SociaCommunityPage_CreationEvent(object sender, EPiServer.ContentEventArgs e)

        {
            if (e.Content is CommunityPage)
            {
                var communityPage = e.Content as CommunityPage;

                var       communityName = communityPage.Name;
                Community community;

                //Check if the community name exists in Social
                //If it does, the page will use the existing Social group and workflow details
                community = groupRepository.Get(communityName);
                if (community == null)
                {
                    //Build a new group
                    communityPage.MetaDescription = String.IsNullOrEmpty(communityPage.MetaDescription) ? "This is the home page for \"" + communityName + "\"" : communityPage.MetaDescription;
                    var groupDescription = communityPage.MetaDescription;
                    var socialGroup      = new Community(communityName, groupDescription);

                    //Add group to Social
                    socialGroup = groupRepository.Add(socialGroup);

                    //Add a workflow for the new group
                    this.moderationRepository.AddWorkflow(socialGroup);
                }

                //Configure CommentBlock
                communityPage.Comments.Heading      = communityName + " Comments";
                communityPage.Comments.ShowHeading  = true;
                communityPage.Comments.SendActivity = true;

                //Configure SubscriptionBlock
                communityPage.Subscriptions.ShowHeading = false;

                //Configure RatingsBlock
                communityPage.Ratings.Heading      = communityName + " Page Rating";
                communityPage.Ratings.ShowHeading  = true;
                communityPage.Ratings.SendActivity = true;

                //Configure GroupAdmissionBlock
                communityPage.GroupAdmission.GroupName   = communityName;
                communityPage.GroupAdmission.ShowHeading = true;
                communityPage.GroupAdmission.Heading     = communityName + " Admission Form";

                //Configure MembershipBlock
                communityPage.Memberships.GroupName   = communityName;
                communityPage.Memberships.ShowHeading = true;
                communityPage.Memberships.Heading     = communityName + " Member List";
            }
        }