Exemplo n.º 1
0
        public async Task <ActionResult> Edit(UserModel model)
        {
            var response = await ApiUtility.PutAsync <UserModel>(Services.Users, model);

            if (response)
            {
                helper.SetPrincipal(WindowsIdentity.GetCurrent().Name);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Exemplo n.º 2
0
        public async Task <ActionResult> AddEdit(BuildViewModel model)
        {
            bool response = false;
            var  apiModel = new BuildModel {
                Name = model.Name, ChangeSet = model.ChangeSet, Release = model.Release, ProjectId = model.ProjectId, ProjectName = model.ProjectName
            };

            #region Upload Files

            string directoryName = string.Format("{0}-{1}-{2}", model.ProjectName, model.Release, model.ChangeSet);
            foreach (var package in model.Packages)
            {
                var file = uploader.Upload(package, directoryName, Path.GetFileName(package.FileName));
                apiModel.Packages.Add(new PackageModel {
                    Name = file.Name, Path = file.Location
                });
            }

            foreach (var script in model.Scripts)
            {
                var file = uploader.Upload(script, directoryName, Path.GetFileName(script.FileName));
                apiModel.Scripts.Add(new SqlScriptModel {
                    Name = file.Name, Extension = file.Extension, Path = file.Location
                });
            }

            #endregion

            if (model.IsNew)
            {
                response = await ApiUtility.PostAsync <BuildModel>(Services.Builds, apiModel);
            }
            else
            {
                response = await ApiUtility.PutAsync <BuildModel>(Services.Builds, apiModel);
            }

            if (response)
            {
                return(RedirectToAction("List"));
            }

            return(View(model));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> AddEdit(TermModel model)
        {
            bool response = false;

            if (model.IsNew)
            {
                response = await ApiUtility.PostAsync <TermModel>(Services.Terms, model);
            }
            else
            {
                response = await ApiUtility.PutAsync <TermModel>(Services.Terms, model);
            }

            if (response)
            {
                return(RedirectToAction("List"));
            }
            return(View(model));
        }