2016-05-06 07:17:38 +03:00
|
|
|
|
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 SiteRepository : Repository<SiteData, string>, ISiteRepository
|
|
|
|
|
{
|
|
|
|
|
public SiteRepository(ISqlService sqlService)
|
|
|
|
|
: base(sqlService)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<SiteData>> GetAllByUserIdAsync(string userId)
|
|
|
|
|
{
|
|
|
|
|
var sites = Connection.Table<SiteData>().Where(f => f.UserId == userId).Cast<SiteData>();
|
|
|
|
|
return Task.FromResult(sites);
|
|
|
|
|
}
|
2016-06-15 06:23:05 +03:00
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<SiteData>> GetAllByUserIdAsync(string userId, bool favorite)
|
|
|
|
|
{
|
|
|
|
|
var sites = Connection.Table<SiteData>().Where(f => f.UserId == userId && f.Favorite == favorite).Cast<SiteData>();
|
|
|
|
|
return Task.FromResult(sites);
|
|
|
|
|
}
|
2016-05-06 07:17:38 +03:00
|
|
|
|
}
|
|
|
|
|
}
|