public IActionResult Index() { List <Models.AnuncioWebmotors> cars = new List <Models.AnuncioWebmotors>(); BD.Repo.AnuncioWebmotors repo = new BD.Repo.AnuncioWebmotors(); cars = repo.Consultar(); return(View(cars)); }
public void Edit(Models.AnuncioWebmotors car) { BD.Repo.AnuncioWebmotors repo = new BD.Repo.AnuncioWebmotors(); if (car.ID == 0) { repo.Incluir(car); } else { repo.Atualizar(car); } }
public IActionResult Car(int id) { Models.AnuncioWebmotors anuncio = new Models.AnuncioWebmotors(); if (id != 0) { anuncio = new BD.Repo.AnuncioWebmotors().Consultar(id); anuncio.modelos = GetModels(anuncio.marca); anuncio.versoes = GetVersions(anuncio.modelo); } anuncio.marcas = GetMakes(); return(View(anuncio)); }
public bool Del(int id) { try { Models.AnuncioWebmotors car = new Models.AnuncioWebmotors(); BD.Repo.AnuncioWebmotors repo = new BD.Repo.AnuncioWebmotors(); car = repo.Consultar(id); repo.Remover(car); return(true); } catch (Exception) { return(false); } }