public async Task <IHttpActionResult> SignIn(postObject theobj)
        {
            string path     = "2.8/auth/signin";
            var    response = await TableauHttpClient.client.PostAsJsonAsync(path, theobj);

            if (response.IsSuccessStatusCode)
            {
                /// to use object :
                postObject TheObj = await response.Content.ReadAsAsync <postObject>();

                //    SwapCurrentHeaderValue("X-Tableau-Auth", TheObj.credentials.token.ToString());
                //   TableauHTTPClient.addHeaderToken(TheObj.credentials.token);

                return(Ok(TheObj));

                // to use string

                /*
                 * var result2 = await response.Content.ReadAsStringAsync();
                 * var details = JObject.Parse(result2);
                 * return Ok(details);
                 */
            }

            return(BadRequest());
        }
Пример #2
0
        public ActionResult <string> TraCuuTTToKhaiHaiQuan(postObject obj)
        {
            HQServiceSoapClient wSHQ = new HQServiceSoapClient(EndpointConfiguration.HQServiceSoap);
            Task <TraCuuTTToKhaiHaiQuanResponse> objRes = wSHQ.TraCuuTTToKhaiHaiQuanAsync(obj.maDN, obj.soTK, obj.cmnd);
            TraCuuTTToKhaiHaiQuanResponse        result = objRes.Result;
            TraCuuTTToKhaiHaiQuanResponseBody    a      = result.Body;
            string b = a.TraCuuTTToKhaiHaiQuanResult;

            return(b);
        }
Пример #3
0
        public IActionResult addPost([FromBody] postObject post)
        {
            try
            {
                var userId = this.help.GetCurrentUser(HttpContext);
                if (userId <= 0)
                {
                    return(StatusCode(401, "الرجاء الـتأكد من أنك قمت بتسجيل الدخول"));
                }
                var perm = this.help.getPermissin("Ads_Add", userId, db);
                if (!perm)
                {
                    return(StatusCode(401, "لا تملك الصلاحية"));
                }


                if (post == null)
                {
                    return(StatusCode(401, "حدتت مشكلة في ارسال البيانات"));
                }

                Ads ads = new Ads();
                ads.Image     = Convert.FromBase64String(post.Photo.Substring(post.Photo.IndexOf(",") + 1));
                ads.Subject   = post.subject;
                ads.Post      = post.post;
                ads.CreatedOn = DateTime.Now;
                ads.CreatedBy = userId;
                ads.Status    = post.status;
                db.Ads.Add(ads);

                db.SaveChanges();
                return(Ok("تمت عملية الإضافة بنجاح "));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }