Refactored ScanLibrary to accept and library id rather than DTO. Refactored ScanLibrary to use Task.Run() rather than having synchronous repo methods.
This commit is contained in:
parent
9168e12483
commit
7b1714349d
9 changed files with 44 additions and 75 deletions
|
|
@ -36,16 +36,7 @@ namespace API.Data
|
|||
return _context.SaveChanges() > 0;
|
||||
}
|
||||
|
||||
public Library GetLibraryForName(string libraryName)
|
||||
{
|
||||
return _context.Library
|
||||
.Where(x => x.Name == libraryName)
|
||||
.Include(f => f.Folders)
|
||||
.Include(s => s.Series)
|
||||
.Single();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LibraryDto>> GetLibrariesForUsernameAysnc(string userName)
|
||||
public async Task<IEnumerable<LibraryDto>> GetLibrariesDtoForUsernameAsync(string userName)
|
||||
{
|
||||
return await _context.Library
|
||||
.Include(l => l.AppUsers)
|
||||
|
|
@ -53,21 +44,22 @@ namespace API.Data
|
|||
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Library> GetLibraryForNameAsync(string libraryName)
|
||||
{
|
||||
return await _context.Library
|
||||
.Where(x => x.Name == libraryName)
|
||||
.Include(f => f.Folders)
|
||||
.Include(s => s.Series)
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LibraryDto>> GetLibrariesAsync()
|
||||
{
|
||||
return await _context.Library
|
||||
.Include(f => f.Folders)
|
||||
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<LibraryDto> GetLibraryDtoForIdAsync(int libraryId)
|
||||
{
|
||||
return await _context.Library
|
||||
.Where(x => x.Id == libraryId)
|
||||
.Include(f => f.Folders)
|
||||
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider).SingleAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<Library> GetLibraryForIdAsync(int libraryId)
|
||||
{
|
||||
return await _context.Library
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue