public void Delete(AnuncioWebMotors anuncio) { using (var context = new DesafioWebMotorsDbContext()) { context.AnuncioWebMotors.Remove(anuncio); context.SaveChanges(); } }
public AnuncioWebMotors Get(int id) { using (var context = new DesafioWebMotorsDbContext()) { var anuncio = context.AnuncioWebMotors.Find(id); return(anuncio); } }
public IEnumerable <AnuncioWebMotors> GetAll() { using (var context = new DesafioWebMotorsDbContext()) { var anuncios = context.AnuncioWebMotors.ToList(); return(anuncios); } }