コード例 #1
0
        async Task AddTag(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                return;
            }

            var tag = new AsanaTag()
            {
                name = name
            };

            IsBusy = true;
            var response = await new AsanaRespository().CreateTag(WorkspaceId, tag);

            if (AsanaClient.ProcessResponse(response))
            {
                response.Data.workspaceid = WorkspaceId;
                await new StorageService().Insert(response.Data);

                Tags.Add(response.Data);

                var selectedTags = SelectedTags;
                selectedTags.Add(response.Data);

                SelectedTags = selectedTags;
            }
            IsBusy = false;
        }
コード例 #2
0
 public async Task <AsanaResponse <AsanaTag> > UpdateTag(AsanaTag tagToUpdate)
 {
     return(await UseRequest <AsanaTag>(
                string.Format("tags/{0}", tagToUpdate.id),
                request =>
     {
         request.AddObject(tagToUpdate);
         request.Method = Method.PUT;
     }));
 }
コード例 #3
0
        async Task DeleteTag(AsanaTag tag)
        {
            var links = await getDb().GetAsyncConnection().Table <AsanaTagTask>().Where(x => x.TagId == tag.id).ToListAsync();

            foreach (var asanaTagTask in links)
            {
                await getDb().Delete(asanaTagTask);
            }
            await getDb().Delete(tag);
        }
コード例 #4
0
 public async Task <AsanaResponse <AsanaTag> > UpdateTag(AsanaTag tagToUpdate)
 {
     return(await UseRequest <AsanaTag>(
                string.Format("tags/{0}", tagToUpdate.id),
                (request, container) =>
     {
         container.AddObject(tagToUpdate);
         request.Method = HttpMethod.Put;
     }));
 }
コード例 #5
0
        public async Task <AsanaResponse <AsanaTag> > CreateTag(long workspaceId, AsanaTag newTag)
        {
            return(await UseRequest <AsanaTag>(
                       GetWorkspaceTagsUrl(workspaceId),
                       request =>
            {
                request.Method = Method.POST;

                var fields = new List <string>();
                fields.Add("name");

                request.AddObject(newTag, fields.ToArray());
            }));
        }