/// <summary>Snippet for CreateTagBindingAsync</summary>
        public async Task CreateTagBindingAsync()
        {
            // Snippet: CreateTagBindingAsync(TagBinding, CallSettings)
            // Additional: CreateTagBindingAsync(TagBinding, CancellationToken)
            // Create client
            TagBindingsClient tagBindingsClient = await TagBindingsClient.CreateAsync();

            // Initialize request argument(s)
            TagBinding tagBinding = new TagBinding();
            // Make the request
            Operation <TagBinding, CreateTagBindingMetadata> response = await tagBindingsClient.CreateTagBindingAsync(tagBinding);

            // Poll until the returned long-running operation is complete
            Operation <TagBinding, CreateTagBindingMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            TagBinding result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <TagBinding, CreateTagBindingMetadata> retrievedResponse = await tagBindingsClient.PollOnceCreateTagBindingAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                TagBinding retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for CreateTagBinding</summary>
        public void CreateTagBindingRequestObject()
        {
            // Snippet: CreateTagBinding(CreateTagBindingRequest, CallSettings)
            // Create client
            TagBindingsClient tagBindingsClient = TagBindingsClient.Create();
            // Initialize request argument(s)
            CreateTagBindingRequest request = new CreateTagBindingRequest
            {
                TagBinding   = new TagBinding(),
                ValidateOnly = false,
            };
            // Make the request
            Operation <TagBinding, CreateTagBindingMetadata> response = tagBindingsClient.CreateTagBinding(request);

            // Poll until the returned long-running operation is complete
            Operation <TagBinding, CreateTagBindingMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            TagBinding result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <TagBinding, CreateTagBindingMetadata> retrievedResponse = tagBindingsClient.PollOnceCreateTagBinding(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                TagBinding retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Exemplo n.º 3
0
 public void Save(TagBinding Model, string UserID)
 {
     using (var _c = db)
     {
         Can(Model.SiteID, UserID, _c);
         if (Model.TagID == 0)
         {
             _c.Tags.Add(new data.Tag
             {
                 TagName = Model.TagName,
                 SiteID  = Model.SiteID
             });
         }
         else
         {
             var _Tag = GetByID(Model.TagID, _c);
             _Tag.TagName = Model.TagName;
         }
         _c.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Save(TagBinding Model, string UserID)
 {
     using (var _c=db)
     {
         Can(Model.SiteID, UserID, _c);
         if (Model.TagID == 0)
         {
             _c.Tags.Add(new data.Tag
             {
                 TagName = Model.TagName,
                 SiteID = Model.SiteID
             });
         }
         else
         {
             var _Tag=GetByID(Model.TagID,_c);
             _Tag.TagName = Model.TagName;
         }
         _c.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public IHttpActionResult PostSave(TagBinding Model)
 {
     _TagService.Save(Model, User.Identity.GetUserId());
     return Ok();
 }
Exemplo n.º 6
0
 public IHttpActionResult PostSave(TagBinding Model)
 {
     _TagService.Save(Model, User.Identity.GetUserId());
     return(Ok());
 }