public ActionResult <ProcessResponse> ProcessDetails(ProcessRequest processRequest) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:51312"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage response = client.GetAsync("api/PackagingAndDelivery?item=" + processRequest.ComponentType + "&count=" + processRequest.Qunatity).Result; if (response.IsSuccessStatusCode) { double cost = response.Content.ReadAsAsync <double>().Result; ProcessResponse response1 = new ProcessResponse(); IProcessingCharge processingCharge; response1.RequestId = _repo.GenerateId(); response1.PackagingAndDeliveryCharge = cost; response1.DateOfDelivery = DateTime.Now.Date.AddDays(5); if (processRequest.ComponentType == "Integral") { processingCharge = new Repair(); response1.ProcessingCharge = processingCharge.ProcessingTheService(processRequest.IsPriorityRequest); if (processRequest.IsPriorityRequest) { response1.DateOfDelivery = DateTime.Now.Date.AddDays(2); } } else { processingCharge = new Replacement(); response1.ProcessingCharge = processingCharge.ProcessingTheService(processRequest.IsPriorityRequest); } _repo.AddRequest(processRequest); _repo.AddResponse(response1); return(Ok(response1)); } else { return(BadRequest("Something went wrong")); } } catch (Exception e) { return(BadRequest(e.Message)); } }