Пример #1
0
 public AuthService(IConfiguration config,
                    SMEAPIContext db,
                    IOptions <ApiURLSettings> apiURLSettings,
                    IOptions <APISettings> apiSettings,
                    IAuthRepository <LoggedUser> loggedUserRepository)
 {
     _config                   = config;
     _db                       = db;
     this.apiURLSettings       = apiURLSettings.Value;
     this.apiSettings          = apiSettings.Value;
     this.loggedUserRepository = loggedUserRepository;
 }
Пример #2
0
        public async Task <bool> AddAsync(T entity, SMEAPIContext _db)
        {
            await _db.AddAsync(entity);

            return(await SaveAsync(_db));
        }
Пример #3
0
 public async Task <bool> UpdateAsync(T entity, SMEAPIContext _db)
 {
     _db.Update(entity);
     return(await SaveAsync(_db));
 }
Пример #4
0
 public async Task <bool> SaveAsync(SMEAPIContext _db)
 {
     return(await _db.SaveChangesAsync() > 0);
 }
Пример #5
0
 public async Task <bool> DeleteAsync(T entity, SMEAPIContext _db)
 {
     _db.Remove(entity);
     return(await SaveAsync(_db));
 }
Пример #6
0
 public AuthRepository(SMEAPIContext db)
 {
     _db = db;
 }