public void ReportTopic(TopicReport report) { string query = @"INSERT INTO TopicReports (TopicID, ReporterID, Reason, DateCreated) values(@TopicID, @ReporterID, @Reason, @DateCreated)"; _connection.Execute(query, new { report.TopicID, report.ReporterID, report.Reason, report.DateCreated }); }
protected void btnReportTopic_Click(object sender, EventArgs e) { var currentUser = _authenticationService.GetAuthenticatedUser(); int topicID = Convert.ToInt32(Page.RouteData.Values["id"]); if (currentUser == null) { redirectToLogin(Request.RawUrl); } var reason = ""; if (listReportTopic.SelectedIndex != -1) { reason = listReportTopic.SelectedItem.Value; } if (txtOther.Text.Length > 0) { reason = txtOther.Text; } var report = new TopicReport(topicID, currentUser.Id, reason, DateTime.Now); _topicService.ReportTopic(report); listReportTopic.SelectedIndex = -1; txtOther.Text = ""; }
private TopicReport GetTopicReport(TrackTopicsEvent topicCollection, TrackTopic topicEvent) { var key = topicEvent.Topic + "#" + topicCollection.Detail + "#" + topicCollection.Url; if (!topicDictionary.TryGetValue(key, out var topicReport)) { topicReport = new TopicReport(topicEvent.Topic, topicCollection.Detail, topicCollection.Url); topicReport.LastVisibleGeneration = Int32.MinValue; topicDictionary[key] = topicReport; } return(topicReport); }
public async Task SendAsync(CreateTopicReportInputModel input) { var topicReport = new TopicReport() { Title = input.Title, Description = input.Description, SenderId = input.SenderId, TopicId = input.TopicId, }; await this.topicReportRepository.AddAsync(topicReport); await this.topicReportRepository.SaveChangesAsync(); }