コード例 #1
0
        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());
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        public async Task ReportMessageAsync(ChatMessageReport report, CancellationToken ct = default)
        {
            await _context.ChatMessageReports.AddAsync(report);

            await _context.SaveChangesAsync(ct);
        }