Esempio n. 1
0
        public static async Task CmdAddOrUpdateReaction(TSReaction ParTSReaction)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSReaction);

            TSReaction tsReactionForSend = GlobalFunctions.CopyObject <TSReaction>(ParTSReaction);


            LocalData.currReaction = await httpClient.MyPostJsonGetJsonAsync("reaction/add", tsReactionForSend);

            httpClient.DefaultRequestHeaders.Accept.Clear();
        }
Esempio n. 2
0
        public static async Task <string> CmdAddCategory(TSCategory ParTSCategory)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSCategory);

            TSCategory tsCategoryForSend = GlobalFunctions.CopyObject <TSCategory>(ParTSCategory);


            string result = await httpClient.PostJsonAsync <string>("category/add", tsCategoryForSend);


            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }
Esempio n. 3
0
        public static async Task <string> CmdTSUserChangePassword(TSUser ParTSUser)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSUser);

            TSUser tsUserForSend = GlobalFunctions.CopyObject <TSUser>(ParTSUser);



            string result = await httpClient.PostJsonAsync <string>("user/changepassword", tsUserForSend);

            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }
Esempio n. 4
0
        public static async Task <string> CmdUpdateTodo(TSTodo ParTSTodo)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSTodo);

            TSTodo tsTodoForSend = GlobalFunctions.CopyObject <TSTodo>(ParTSTodo);

            GlobalFunctions.CmdAdjustDate(tsTodoForSend, true);


            string result = await httpClient.PutJsonAsync <string>("todo/update", tsTodoForSend);


            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }
Esempio n. 5
0
        public static async Task <string> CmdDeleteCategory(TSCategory ParTSCategory)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSCategory);


            TSCategory tsCategoryForSend = new TSCategory();

            tsCategoryForSend.UserID = ParTSCategory.UserID;
            tsCategoryForSend.ID     = ParTSCategory.ID;

            string result = await httpClient.SendJsonAsync <string>(HttpMethod.Delete, "category/delete", tsCategoryForSend);


            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }
Esempio n. 6
0
        public static async Task <string> CmdDeleteTodo(TSTodo ParTSTodo)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSTodo);

            //TSTodo tsTodoForSend = GlobalFunctions.CopyObject<TSTodo>(ParTSTodo);

            TSTodo tsTodoForSend = new TSTodo();

            tsTodoForSend.UserID = ParTSTodo.UserID;
            tsTodoForSend.ID     = ParTSTodo.ID;


            string result = await httpClient.SendJsonAsync <string>(HttpMethod.Delete, "todo/delete", tsTodoForSend);


            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }