From edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c Mon Sep 17 00:00:00 2001 From: transtrike Date: Fri, 11 Dec 2020 00:39:23 +0200 Subject: Fixed Validations in UserService. Removed unnessessary code. Swagger not working --- API/Database/DbRepository.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'API/Database/DbRepository.cs') diff --git a/API/Database/DbRepository.cs b/API/Database/DbRepository.cs index 184adb4..a24be36 100644 --- a/API/Database/DbRepository.cs +++ b/API/Database/DbRepository.cs @@ -11,6 +11,7 @@ namespace API.Database where TEntity : class { private readonly DbContext _context; + public DbRepository(DbContext context) { _context = context; @@ -34,23 +35,18 @@ namespace API.Database .FindAsync(id); } - public IEnumerable Query() + public IEnumerable Query(int count) { return this._context .Set() .AsNoTracking() + .Take(count) .AsEnumerable(); } - public IEnumerable Query(int count) - { - return this.Query().Take(count); - } - //Update public async Task EditAsync(object id, TEntity newEntity) { - //Set the Id property to the given id TEntity entity = await FindByIdAsync(id); this._context.Entry(entity) @@ -69,5 +65,7 @@ namespace API.Database await this._context.SaveChangesAsync(); } + + public DbSet DbSet => this._context.Set(); } } -- cgit v1.2.3