public async Task <IActionResult> ReportUser([FromBody] ChatMessageReport report, CancellationToken ct = default) { if (!AuthenticationUtilities.IsAllowedChat(User)) { return(BadRequest("User has been banned from Chat")); } await _chatService.ReportMessageAsync(report, ct); return(Ok()); }
public async Task MarkReportAsDeletedAsync(int reportId, CancellationToken ct = default) { ChatMessageReport report = await _context.ChatMessageReports.FindAsync(reportId); if (report != null) { report.IsDeleted = true; _context.Update(report); await _context.SaveChangesAsync(); } }
public async Task ReportMessageAsync(ChatMessageReport report, CancellationToken ct = default) { await _context.ChatMessageReports.AddAsync(report); await _context.SaveChangesAsync(ct); }