i have one Repository class(Repository.cs) with some methods for getting the data, methods are
- public async Task<List<T>> Get()
- {
- return await _db.Table<T>().ToListAsync();
- }
2)
- public async Task<T> Get(Expression<Func<T, bool>> predicate)
- {
- return await _db.FindAsync<T>(predicate);
- }
3)
- public async Task<T> Get(int id)
- {
- return await _db.FindAsync<T>(id);
- }
i have one table Expense..
- public class Expence : EntityClass
- {
- public string Date { get; set; }
- public decimal Amount { get; set; }
- public string Purpose_Of_Spending { get; set; }
- public string Type { get; set; }
- }
Now i want to get data between two dates from Expense table, how can i do that please help, Here i'm using SQLite database with AsyncSqliteConnection
i have tried like that
- public async void queryvals()
- {
- Repository<Expence> repo = new Repository<Expence>();
- SQLiteAsyncConnection con = DatabaseAccess.GetConnection();
-
- var DateData = con.QueryAsync<Expence>("SELECT * FROM Expence WHERE Date between '" + FrmDate.Text + "' AND '" + ToDate.Text + "'");
- var DatesData2 = await repo.Get(x => (x.Date == ToDate.Text) && (x.Date == FrmDate.Text));
- }
but i'm not getting the data, how should i do that can anyone suggest me.Thank you