public ApiBoolResponseDTO AddManagedUpdateToTemplate(MunkiManifestManagedUpdateEntity managedUpdate) { return(new ApiBoolResponseDTO { Value = _munkiManifestTemplateServices.AddManagedUpdateToTemplate(managedUpdate) }); }
public bool AddManagedUpdateToTemplate(MunkiManifestManagedUpdateEntity managedUpdate) { Request.Method = Method.POST; Request.Resource = string.Format("api/{0}/AddManagedUpdateToTemplate/", Resource); Request.AddJsonBody(managedUpdate); var response = _apiRequest.Execute <ApiBoolResponseDTO>(Request); return(response != null && response.Value); }
protected void buttonUpdate_OnClick(object sender, EventArgs e) { RequiresAuthorization(AuthorizationStrings.UpdateGlobal); var updateCount = 0; foreach (GridViewRow row in gvPkgInfos.Rows) { var enabled = (CheckBox)row.FindControl("chkSelector"); if (enabled == null) { continue; } if (!enabled.Checked) { continue; } var dataKey = gvPkgInfos.DataKeys[row.RowIndex]; if (dataKey == null) { continue; } var managedUpdate = new MunkiManifestManagedUpdateEntity { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id }; var condition = (TextBox)row.FindControl("txtCondition"); managedUpdate.Condition = condition.Text; if (Call.MunkiManifestTemplateApi.AddManagedUpdateToTemplate(managedUpdate)) { updateCount++; } } if (updateCount > 0) { EndUserMessage = "Successfully Updated Managed Updates"; ManifestTemplate.ChangesApplied = 0; Call.MunkiManifestTemplateApi.Put(ManifestTemplate.Id, ManifestTemplate); } else { EndUserMessage = "Could Not Update Managed Updates"; } PopulateGrid(); }
public bool AddManagedUpdateToTemplate(MunkiManifestManagedUpdateEntity managedUpdate) { if ( !_uow.MunkiManagedUpdateRepository.Exists( s => s.Name == managedUpdate.Name && s.ManifestTemplateId == managedUpdate.ManifestTemplateId)) { _uow.MunkiManagedUpdateRepository.Insert(managedUpdate); } else { managedUpdate.Id = _uow.MunkiManagedUpdateRepository.GetFirstOrDefault( s => s.Name == managedUpdate.Name && s.ManifestTemplateId == managedUpdate.ManifestTemplateId) .Id; _uow.MunkiManagedUpdateRepository.Update(managedUpdate, managedUpdate.Id); } _uow.Save(); return(true); }