//protected IAuthorRepository repo;

        public AuthorRepositoryShould()
        {
            var             factory = new AuthorDbContextFactory();
            AuthorDbContext db      = factory.CreateDbContext(null);

            this.repo = new AuthorRepository(db);
        }
예제 #2
0
 public List <Author> GetAuthors()
 {
     using (var context = new AuthorDbContext())
     {
         return(context.Authors.ToList());
     }
 }
예제 #3
0
 public List <Book> GetBooks()
 {
     using (var context = new AuthorDbContext())
     {
         return(context.Books.ToList());
     }
 }
예제 #4
0
 public Author Delete(int id)
 {
     using (var context = new AuthorDbContext())
     {
         Author author = context.Authors.Find(id);
         return(author);
     }
 }
예제 #5
0
 public AdminController(IGenomeService genomeService, RoleManager <IdentityRole> roleManager, UserManager <AuthorTestUser> userManager, AuthorDbContext authorDbContext, IHttpContextAccessor httpContextAccessor, SignInManager <AuthorTestUser> signInManager)
 {
     this.roleManager         = roleManager;
     this.userManager         = userManager;
     this.authorDbContext     = authorDbContext;
     this.httpContextAccessor = httpContextAccessor;
     this.signInManager       = signInManager;
     gsv = genomeService;
 }
예제 #6
0
 public GenomeService(RoleManager <IdentityRole> roleManager, UserManager <AuthorTestUser> userManager, IHttpContextAccessor httpContextAccessor, AuthorDbContext authorDbContext, SignInManager <AuthorTestUser> signInManager)
 {
     this.roleManager         = roleManager;
     this.userManager         = userManager;
     this.authorDbContext     = authorDbContext;
     this.httpContextAccessor = httpContextAccessor;
     this.signInManager       = signInManager;
     dataSeeder = new DataSeeder();
 }
예제 #7
0
        public List <Author> EditComplite(Author author)
        {
            using (var context = new AuthorDbContext())
            {
                context.Entry(author).State = EntityState.Modified;
                context.SaveChanges();

                return(context.Authors.ToList());
            }
        }
예제 #8
0
 public ResearcherController(IGenomeService genomeService, IFileService fileService, RoleManager <IdentityRole> roleManager, UserManager <AuthorTestUser> userManager, IHttpContextAccessor httpContextAccessor, AuthorDbContext authorDbContext, SignInManager <AuthorTestUser> signInManager, IConfiguration configuration)
 {
     this.roleManager         = roleManager;
     this.userManager         = userManager;
     this.httpContextAccessor = httpContextAccessor;
     this.authorDbContext     = authorDbContext;
     this.configuration       = configuration;
     gsv = genomeService;
     fsv = fileService;
 }
예제 #9
0
        public FileService(RoleManager <IdentityRole> roleManager, UserManager <AuthorTestUser> userManager, IHttpContextAccessor httpContextAccessor, AuthorDbContext authorDbContext, SignInManager <AuthorTestUser> signInManager, IConfiguration configuration)
        {
            this.roleManager         = roleManager;
            this.userManager         = userManager;
            this.authorDbContext     = authorDbContext;
            this.httpContextAccessor = httpContextAccessor;
            this.signInManager       = signInManager;
            dataSeeder = new DataSeeder();

            this.configuration = configuration;
        }
예제 #10
0
        public List <Book> Create(Book book)
        {
            using (var context = new AuthorDbContext())
            {
                context.Books.Add(book);

                context.SaveChanges();

                return(context.Books.ToList());
            }
        }
예제 #11
0
        public List <Author> Create(Author author)
        {
            using (var context = new AuthorDbContext())
            {
                context.Authors.Add(author);

                context.SaveChanges();

                return(context.Authors.ToList());
            }
        }
예제 #12
0
        public List <Author> DeleteConfirmed(int id)
        {
            using (var context = new AuthorDbContext())
            {
                Author author = context.Authors.Find(id);

                context.Authors.Remove(author);

                context.SaveChanges();

                return(context.Authors.ToList());
            }
        }
예제 #13
0
 public BookAuthor(AuthorDbContext context)
 {
     _context = context;
 }
예제 #14
0
 public BaseRepositories(AuthorDbContext context)
 {
     _context = context;
     table    = context.Set <TEntity>();
 }
예제 #15
0
 public UnitOfWork(AuthorDbContext context)
 {
     AuthRepository = new BaseRepositories <Core.Entity.Author>(context);
     _context       = context;
 }
 public AuthorService(AuthorDbContext authorDbContext)
 {
     _authorDbContext = authorDbContext;
 }
예제 #17
0
 public AuthorUnitofWork(AuthorDbContext _db)
 {
     db = _db;
 }
예제 #18
0
 public AuthorController(AuthorDbContext context)
 {
     this.context = context;
 }