Exemple #1
0
        public async Task <ResultSingle <Deployment> > CreateDeployment(Deployment deployment = null,
                                                                        bool doCache          = true, bool throwIfError = true)
        {
            Deployment theDeployment = deployment == null ? _editApp.Deployment : deployment;

            Dictionary <string, object> data = new Dictionary <string, object>();

            if (ApplyCredit != null)
            {
                data.Add("credit_id", ApplyCredit.Id.ToString());
            }

            ResultSingle <Deployment> result = await ResultSingleUI <Deployment> .WaitForObjectAsync(
                throwIfError, theDeployment, new CachedHttpRequest <Deployment, ResultSingle <Deployment> >(
                    Backend.CreateAsync), doCache, data);

            if (result.Code >= 0)
            {
                _editDeployment     = result.Data.Payload;
                _editApp.Deployment = _editDeployment;

                if (deployment != null)
                {
                    _editDeployment.CopyTo(deployment);
                    _deployments.Add(deployment);
                    OnPropertyChanged("Deployments");
                }
            }

            return(result);
        }