Ejemplo n.º 1
0
        public ActionResult CreateTagRelationship(TagRelations tagRelations)
        {
            if (HttpContext.Session.GetString("user_type") != "A")
            {
                return(RedirectToAction("index", "login"));
            }
            HttpClient client     = new HttpClient();
            string     callingUrl = APIHelper.BaseUrl + "/TagRelatoinship";

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", HttpContext.Request.Cookies["token"].ToString());
            try
            {
                var response = client.PostAsJsonAsync(callingUrl, tagRelations).Result;
                if (response.IsSuccessStatusCode)
                {
                    return(Json("done"));
                }
            }
            catch (Exception ex)
            {
            }
            return(Json("error"));
        }
Ejemplo n.º 2
0
        public ActionResult CreateTagRelationship()
        {
            if (HttpContext.Session.GetString("user_type") != "A")
            {
                return(RedirectToAction("index", "login"));
            }
            HttpClient client     = new HttpClient();
            string     callingUrl = APIHelper.BaseUrl + "/Tags";

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", HttpContext.Request.Cookies["token"].ToString());
            try
            {
                var          response = client.GetAsync(callingUrl).Result;
                var          data     = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Tag> >(response.Content.ReadAsStringAsync().Result);
                TagRelations tr       = new TagRelations();
                tr.FamilyTagMembers = data;
                return(View(tr));
            }
            catch (Exception ex)
            {
            }
            return(RedirectToAction("index", "home"));
        }