mirror of
https://github.com/bitwarden/mobile
synced 2026-02-25 08:53:20 +00:00
refactoring code for login => cipher support
This commit is contained in:
29
src/App/Repositories/CipherRepository.cs
Normal file
29
src/App/Repositories/CipherRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models.Data;
|
||||
|
||||
namespace Bit.App.Repositories
|
||||
{
|
||||
public class CipherRepository : Repository<CipherData, string>, ICipherRepository
|
||||
{
|
||||
public CipherRepository(ISqlService sqlService)
|
||||
: base(sqlService)
|
||||
{ }
|
||||
|
||||
public Task<IEnumerable<CipherData>> GetAllByUserIdAsync(string userId)
|
||||
{
|
||||
var logins = Connection.Table<CipherData>().Where(l => l.UserId == userId).Cast<CipherData>();
|
||||
return Task.FromResult(logins);
|
||||
}
|
||||
|
||||
public Task<IEnumerable<CipherData>> GetAllByUserIdAsync(string userId, bool favorite)
|
||||
{
|
||||
var logins = Connection.Table<CipherData>().Where(l => l.UserId == userId && l.Favorite == favorite)
|
||||
.Cast<CipherData>();
|
||||
return Task.FromResult(logins);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user