Calendar attachments.

This commit is contained in:
Burak Kaan Köse
2026-01-03 23:59:37 +01:00
parent c8ef031e7d
commit 4603b1fb14
20 changed files with 758 additions and 21 deletions
+34
View File
@@ -480,4 +480,38 @@ public class CalendarService : BaseDatabaseService, ICalendarService
}
});
}
#region Attachments
public Task<List<CalendarAttachment>> GetAttachmentsAsync(Guid calendarItemId)
=> Connection.Table<CalendarAttachment>().Where(x => x.CalendarItemId == calendarItemId).ToListAsync();
public async Task InsertOrReplaceAttachmentsAsync(List<CalendarAttachment> attachments)
{
if (attachments == null || attachments.Count == 0) return;
foreach (var item in attachments)
{
await Connection.InsertOrReplaceAsync(item, typeof(CalendarAttachment));
}
}
public async Task MarkAttachmentDownloadedAsync(Guid attachmentId, string localFilePath)
{
var attachment = await Connection.Table<CalendarAttachment>().FirstOrDefaultAsync(x => x.Id == attachmentId);
if (attachment == null) return;
attachment.IsDownloaded = true;
attachment.LocalFilePath = localFilePath;
await Connection.UpdateAsync(attachment, typeof(CalendarAttachment));
}
public async Task DeleteAttachmentsAsync(Guid calendarItemId)
{
await Connection.ExecuteAsync("DELETE FROM CalendarAttachment WHERE CalendarItemId = ?", calendarItemId);
}
#endregion
}