public async Task <IActionResult> Create([Bind("ID,marca,modelo,versao,ano,quilometragem,observacao")] MotorsAdModel.Ad ad) { if (ModelState.IsValid) { await _adsApi.ApiAdsPostAsync(TransformData2Rest(ad)); return(RedirectToAction(nameof(Index))); } return(View(ad)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,marca,modelo,versao,ano,quilometragem,observacao")] MotorsAdModel.Ad ad) { if (id != ad.ID) { return(NotFound()); } if (ModelState.IsValid) { await _adsApi.ApiAdsIdPutAsync(id, TransformData2Rest(ad)); return(RedirectToAction(nameof(Index))); } return(View(ad)); }