public bool AddCatalogToTemplate(MunkiManifestCatalogEntity catalog) { Request.Method = Method.POST; Request.Resource = string.Format("api/{0}/AddCatalogToTemplate/", Resource); Request.AddJsonBody(catalog); 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 gvCatalogs.Rows) { var enabled = (CheckBox)row.FindControl("chkSelector"); if (enabled == null) { continue; } if (!enabled.Checked) { continue; } var dataKey = gvCatalogs.DataKeys[row.RowIndex]; if (dataKey == null) { continue; } var catalog = new MunkiManifestCatalogEntity { Name = dataKey.Value.ToString(), ManifestTemplateId = ManifestTemplate.Id }; var txtPriority = row.FindControl("txtPriority") as TextBox; if (txtPriority != null) { if (!string.IsNullOrEmpty(txtPriority.Text)) { catalog.Priority = Convert.ToInt32(txtPriority.Text); } } if (Call.MunkiManifestTemplateApi.AddCatalogToTemplate(catalog)) { updateCount++; } } if (updateCount > 0) { EndUserMessage = "Successfully Updated Catalogs"; ManifestTemplate.ChangesApplied = 0; Call.MunkiManifestTemplateApi.Put(ManifestTemplate.Id, ManifestTemplate); } else { EndUserMessage = "Could Not Update Catalogs"; } PopulateGrid(); }
public bool AddCatalogToTemplate(MunkiManifestCatalogEntity catalog) { if ( !_uow.MunkiCatalogRepository.Exists( s => s.Name == catalog.Name && s.ManifestTemplateId == catalog.ManifestTemplateId)) { _uow.MunkiCatalogRepository.Insert(catalog); } else { catalog.Id = _uow.MunkiCatalogRepository.GetFirstOrDefault( s => s.Name == catalog.Name && s.ManifestTemplateId == catalog.ManifestTemplateId).Id; _uow.MunkiCatalogRepository.Update(catalog, catalog.Id); } _uow.Save(); return(true); }
public ApiBoolResponseDTO AddCatalogToTemplate(MunkiManifestCatalogEntity catalog) { return(new ApiBoolResponseDTO { Value = _munkiManifestTemplateServices.AddCatalogToTemplate(catalog) }); }