public ActionResult CreateVehicle(VehicleModel vehiclemodel) { using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", Session["TokenKey"].ToString()); VehicleRequestDto request = vehiclemodel.GetDto(); var jsonRequestString = JsonConvert.SerializeObject(request); var stringContent = new StringContent(jsonRequestString, Encoding.UTF8, "application/json"); var response = client.PostAsync(endPoints.CreateVehicle, stringContent).Result; } ViewBag.message = "Vehicle has been registered!"; return(View("Home")); }