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; }
public async Task <bool> AddAsync(T entity, SMEAPIContext _db) { await _db.AddAsync(entity); return(await SaveAsync(_db)); }
public async Task <bool> UpdateAsync(T entity, SMEAPIContext _db) { _db.Update(entity); return(await SaveAsync(_db)); }
public async Task <bool> SaveAsync(SMEAPIContext _db) { return(await _db.SaveChangesAsync() > 0); }
public async Task <bool> DeleteAsync(T entity, SMEAPIContext _db) { _db.Remove(entity); return(await SaveAsync(_db)); }
public AuthRepository(SMEAPIContext db) { _db = db; }