// GET: History/Delete/5
public async Task <ActionResult> Delete(int id)
{
    History           ModelGlobal = default(History);
    DeleteHistoryForm ModelLocal  = default(DeleteHistoryForm);

    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri(Baseurl);
        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        HttpResponseMessage Res = await client.GetAsync($"History/Get/{id}");

        if (Res.IsSuccessStatusCode)
        {
            var EmpResponse = Res.Content.ReadAsStringAsync().Result;
            ModelGlobal = JsonConvert.DeserializeObject <History>(EmpResponse);
            ModelLocal  = AutoMapper <History, DeleteHistoryForm> .AutoMap(ModelGlobal);
        }
    }


    List <GetCarForm> getcarformList = await CarController.GetCarList();

    List <GetSellerForm> getsellerformList = await SellerController.GetSellerList();

    List <GetBuyerForm> getbuyerformList = await BuyerController.GetBuyerList();

    var data = (from b in getcarformList
                where b.IdCar == ModelLocal.IdCar
                select b.ModelName).FirstOrDefault();

    var data2 = (from b in getcarformList
                 where b.IdCar == ModelLocal.IdCar
                 select b.ChassisNumber).FirstOrDefault();

    ModelLocal.CarName = data + " - " + data2;

    data = (from b in getsellerformList
            where b.IdSeller == ModelLocal.IdSeller
            select b.Name).FirstOrDefault();

    ModelLocal.SellerName = data;

    data = (from b in getbuyerformList
            where b.IdBuyer == ModelLocal.IdBuyer
            select b.FirstName).FirstOrDefault();
    data2 = (from b in getbuyerformList
             where b.IdBuyer == ModelLocal.IdBuyer
             select b.LastName).FirstOrDefault();

    ModelLocal.BuyerName = data + ' ' + data2;

    return(View(ModelLocal));
}
public async Task <ActionResult> Delete(int id, [Bind] DeleteHistoryForm formulaire)
{
    if (ModelState.IsValid)
    {
        using (var client = new HttpClient())
        {
            client.BaseAddress = new Uri(Baseurl);
            client.DefaultRequestHeaders.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage Res = await client.DeleteAsync($"History/Delete/{id}");

            if (!Res.IsSuccessStatusCode)           /*error handling*/
            {
            }
        }

        return(RedirectToAction("Index"));
    }
    else
    {
        return(View());
    }
}