public ActionResult Assets(string SKU) { SKUStock AssetDetails = new SKUStock(); var skustock = AssetLookUp(SKU).Result; if (skustock != null) { AssetDetails.Make = skustock.Make; AssetDetails.Model = skustock.Model; AssetDetails.Colour = skustock.Colour; AssetDetails.Capacity = skustock.Capacity; AssetDetails.SKU = skustock.SKU; } return(PartialView("Assets", AssetDetails)); }
public async static Task <SKUStock> AssetLookUp(string SKU) { SKUStock returnmessage = new SKUStock(); string BaseUri = ConfigurationManager.AppSettings["baseUri"]; using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(BaseUri); HttpResponseMessage response = client.GetAsync(string.Format("AssetManagementService/inventorycontrol/assets/{0}/AssetLookUp", SKU)).Result; if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsAsync <SKUStock>(); returnmessage = result;// Mapper.Map<SKUStock>(result); } } return(returnmessage); }