public async Task <IActionResult> PostLink(string targetObjectID, string[] objectBIDs, string[] objectLinkTypes) { var link = new ObjectLinkPostViewModel() { ObjectBID = long.Parse(objectBIDs[0]), ObjectLinkType = objectLinkTypes[0], TargetObjectID = long.Parse(targetObjectID) }; using (var httpClient = new HttpClient()) { var requestUri = $"{Configuration.DefaultAPI}/objectlinks/post"; httpClient.DefaultRequestHeaders.Add("CurrentUserID", CurrentUserID.ToString()); httpClient.DefaultRequestHeaders.Add("CurrentHomeID", CurrentHomeID.ToString()); using (var response = await httpClient.PostAsJsonAsync(requestUri, link)) { string content = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { link = JsonConvert.DeserializeObject <ObjectLinkPostViewModel>(content); } } } return(Json(ObjectLinksRenderer.BuildPostLink(link))); }
public static string BuildPostLink(ObjectLinkPostViewModel link) { return($"<div class='row'><div class='col-md-2'><strong>This object</strong></div><div class='col-md-3'>{link.ObjectLinkType}</div><div class='col-md-2'>{link.ObjectBName}</div></div>"); }