d85f2e0fb3
Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich cleanup and rework PDF switch to HTML export fix Colorsystem Farben für knöpfe hinzugefügt als anpassung button color button color primary and secondary change
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using cfs_tracker.Models;
|
|
|
|
namespace cfs_tracker.Data;
|
|
|
|
public class NotificationScheduleRepository
|
|
{
|
|
private readonly AppDatabase _database;
|
|
|
|
public NotificationScheduleRepository(AppDatabase database)
|
|
{
|
|
_database = database;
|
|
}
|
|
|
|
public async Task<List<NotificationSchedule>> GetAllAsync()
|
|
{
|
|
await _database.InitAsync();
|
|
|
|
return await _database.Connection.Table<NotificationSchedule>()
|
|
.OrderBy(x => x.DayOfWeekValue)
|
|
.ThenBy(x => x.Hour)
|
|
.ThenBy(x => x.Minute)
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task ReplaceAllAsync(IEnumerable<NotificationSchedule> schedules)
|
|
{
|
|
await _database.InitAsync();
|
|
|
|
await _database.Connection.DeleteAllAsync<NotificationSchedule>();
|
|
|
|
foreach (var schedule in schedules
|
|
.OrderBy(x => x.DayOfWeekValue)
|
|
.ThenBy(x => x.Hour)
|
|
.ThenBy(x => x.Minute))
|
|
{
|
|
await _database.Connection.InsertAsync(new NotificationSchedule
|
|
{
|
|
DayOfWeekValue = schedule.DayOfWeekValue,
|
|
Hour = schedule.Hour,
|
|
Minute = schedule.Minute,
|
|
IsEnabled = schedule.IsEnabled
|
|
});
|
|
}
|
|
}
|
|
}
|