Ejemplo n.º 1
0
 void ISpamRepository.ReportSpammer(SpammerReport report)
 {
     using (var dc = CreateContext())
     {
         dc.SpammerReportEntities.InsertOnSubmit(report.Map());
         dc.SubmitChanges();
     }
 }
Ejemplo n.º 2
0
 public static SpammerReportEntity Map(this SpammerReport report)
 {
     return(new SpammerReportEntity
     {
         id = Guid.NewGuid(),
         reportedByUserId = report.ReportedByUserId,
         reportedTime = report.ReportedTime,
         userId = report.Spammer.UserId,
         firstName = report.Spammer.FirstName,
         lastName = report.Spammer.LastName,
     });
 }
Ejemplo n.º 3
0
        void ISpamCommand.ReportSpammer(Guid reportedById, Spammer spammer)
        {
            // Create a report entry.

            spammer.Prepare();
            spammer.Validate();

            var report = new SpammerReport {
                ReportedByUserId = reportedById, ReportedTime = DateTime.Now, Spammer = spammer
            };

            _repository.ReportSpammer(report);

            // Check whether this user is classified as a spammer.

            if (IsReportedSpammer(spammer))
            {
                _repository.CreateSpammer(spammer);
            }
        }