Exemple #1
0
        public override void Handle(Report report, RepoFacade repo)
        {
            Ad   ad    = repo.GetAd(report.AdCategory, report.AdId);
            User owner = repo.GetUser(ad.UserId);

            string userPopover   = $"<a data-toggle='popover'  data-container='body'  data-placement='top' data-html='true' data-content='<b>Email</b>: {owner.Email}<br><b>Phone</b>: {owner.Phone}'>{owner.Name}</a>";
            string reportPopover = $"<a data-toggle='popover'  data-container='body'  data-placement='top' data-html='true' data-content='<b>Type</b>: {report.Type}<br><b>Comment</b>: {report.Comment}'>reported</a>";
            string message       = $"<a href='/Home/Ad/?id={ad.Id}&category={ad.Category}'>{ad.Title}</a> (owner: {userPopover}) was {reportPopover}! <span class='notification-date'>[{DateTime.Now}]<span>";

            repo.NotifyUser(message, NotificationType.Report, (repo.GetAdmin()).Id);
        }
 private async Task Notify(int userId, string title, string text)
 {
     User user = repo.GetUser(userId);
     await hubContext.Clients.User(user.Email).SendAsync("Notify", title, text);
 }