public IActionResult Index() { List <Models.Anuncio> cars = new List <Models.Anuncio>(); BD.Repo.Anuncio repo = new BD.Repo.Anuncio(); cars = repo.Consultar(); return(View(cars)); }
public void Edit(Models.Anuncio car) { BD.Repo.Anuncio repo = new BD.Repo.Anuncio(); if (car.ID == 0) { repo.Incluir(car); } else { repo.Atualizar(car); } }
public IActionResult Car(int id) { Models.Anuncio anuncio = new Models.Anuncio(); if (id != 0) { anuncio = new BD.Repo.Anuncio().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.Anuncio car = new Models.Anuncio(); BD.Repo.Anuncio repo = new BD.Repo.Anuncio(); car = repo.Consultar(id); repo.Remover(car); return(true); } catch (Exception) { return(false); } }