Пример #1
0
            protected void Handle(Input.SubmitTrigger action)
            {
                action.Cancel();
                this.IsVisible = false;

                Branch      branch = null;
                ProductPage parent = this.ParentPage;

                Db.Transact(() =>
                {
                    if (!parent.Repository.CurrentCommit.IsClosed)
                    {
                        return;
                    }

                    Branch current = parent.Repository.CurrentBranch;
                    string name    = this.Name.Trim();

                    if (string.IsNullOrEmpty(name))
                    {
                        name = $"{current.Name}-fork";
                    }

                    branch = new Branch(name, current);
                    parent.SelectBranch(branch);
                });

                parent.Branches.Add().Data = branch;
            }
Пример #2
0
            protected void Handle(Input.SubmitTrigger action)
            {
                if (string.IsNullOrWhiteSpace(this.Name))
                {
                    return;
                }

                string name = this.Name.Trim();

                Db.Transact(() =>
                {
                    Repository repository = new Repository(this.Name + " Repository");
                    Product product       = new Product(repository)
                    {
                        Name = name
                    };
                });

                action.Cancel();
                this.VisibleTrigger = false;
                this.ParentPage.RefreshProducts();
            }