public async System.Threading.Tasks.Task <ActionResult> Delete(string tag) { HttpClient client = new HttpClient(); var values = new Dictionary <string, string> { { "Tag", tag } }; var content = new FormUrlEncodedContent(values); string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/"; var response = await client.PostAsync(baseUrl + "api/Relations/RemovePact", content); return(View("Pacts", JsonConvert.DeserializeObject <List <Relation> >(JsonModels.GetJson((Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/") + "api/relations/byset/" + Startup.Storage.Reset)))); }
public ActionResult AddPact(Relation relation) { if (relation.ValidateRelation()) { Startup.Storage.Relations.Add(relation); Startup.Storage.newlyAddedRelations = true; if (Request.UrlReferrer.AbsolutePath == "/relations/New") { return(View("Pacts", JsonConvert.DeserializeObject <List <Relation> >(JsonModels.GetJson((Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/") + "api/relations/byset/" + Startup.Storage.Reset)))); } else { return(Json(true, JsonRequestBehavior.DenyGet)); } } if (Request.UrlReferrer.AbsolutePath == "/relations/New") { return(View("Pacts", JsonConvert.DeserializeObject <List <Relation> >(JsonModels.GetJson((Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/") + "api/relations/byset/" + Startup.Storage.Reset)))); } else { return(Json(false, JsonRequestBehavior.DenyGet)); } }
public ActionResult Pacts() { return(View(JsonConvert.DeserializeObject <List <Relation> >(JsonModels.GetJson((Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/") + "api/relations/byset/" + Startup.Storage.Reset)))); }