| 883 | } |
| 884 | |
| 885 | public async Task<bool> SetTaskLabelsAsync(int taskId, List<int> labelIds, int userId) |
| 886 | { |
| 887 | var existing = await _db.TaskLabels.Where(tl => tl.TaskCardId == taskId).ToListAsync(); |
| 888 | _db.TaskLabels.RemoveRange(existing); |
| 889 | |
| 890 | foreach (var lid in labelIds.Distinct()) |
| 891 | { |
| 892 | _db.TaskLabels.Add(new TaskLabel { TaskCardId = taskId, LabelId = lid }); |
| 893 | } |
| 894 | |
| 895 | await _db.SaveChangesAsync(); |
| 896 | await LogActivity(taskId, userId, "Labels Updated", "Updated task labels"); |
| 897 | |
| 898 | return true; |
| 899 | } |
| 900 | |
| 901 | // Attachment Methods |
| 902 | public async Task<List<AttachmentDto>> GetAttachmentsAsync(int taskId, int userId) |