public IEnumerable <Author> GetAll() { var context = new BookstoreContext(); var authors = context.Set <Author>().ToList(); return(authors); }
public IEnumerable <Book> GetAll() { var context = new BookstoreContext(); var books = context.Set <Book>().ToList(); return(books); }
public void Add(Author entity) { var context = new BookstoreContext(); var dbSet = context.Set <Author>(); dbSet.Add(entity); context.SaveChanges(); }
public T Insert(T item) { context.Set <T>().Add(item); context.SaveChanges(); return(item); }
public Repository(BookstoreContext ctx) { context = ctx; dbSet = context.Set <T>(); }
public virtual T Get(Guid id) { return(_contexto .Set <T>() .FirstOrDefault(x => x.Id == id)); }