예제 #1
0
 public void Delete(AnuncioWebMotors anuncio)
 {
     using (var context = new DesafioWebMotorsDbContext())
     {
         context.AnuncioWebMotors.Remove(anuncio);
         context.SaveChanges();
     }
 }
예제 #2
0
        public AnuncioWebMotors Get(int id)
        {
            using (var context = new DesafioWebMotorsDbContext())
            {
                var anuncio = context.AnuncioWebMotors.Find(id);

                return(anuncio);
            }
        }
예제 #3
0
        public IEnumerable <AnuncioWebMotors> GetAll()
        {
            using (var context = new DesafioWebMotorsDbContext())
            {
                var anuncios = context.AnuncioWebMotors.ToList();

                return(anuncios);
            }
        }