Esempio n. 1
0
        [ValidateAntiForgeryToken]//http://stackoverflow.com/questions/10851283/antiforgerytoken-deprecated-in-asp-net-mvc-4-rc
        public string ReportEntity(long entityId, EntityType entityType, string comments, ReportEntityType offenceType)
        {
            var status = string.Empty;
            if (!string.IsNullOrWhiteSpace(comments))
            {
                var report = new ReportEntityDetails()
                {
                    Comment = comments,
                    ReportEntityID = entityId,
                    ParentID = entityId,
                    Status = OffensiveStatusType.Flagged,
                    ReportedByID = CurrentUserId,
                    ReportEntityType = offenceType
                };

                switch (entityType)
                {
                    case EntityType.Community:
                    case EntityType.Folder:
                        _reportEntityService.ReportOffensiveCommunity(report);
                        break;
                    case EntityType.Content:
                        _reportEntityService.ReportOffensiveContent(report);
                        break;
                    default:
                        break;
                }

                // TODO: Only on succeeded we need to send the notification email.
                SendOffensiveEntityMail(report, entityType);
            }
            return status;
        }
        [ValidateAntiForgeryToken]//http://stackoverflow.com/questions/10851283/antiforgerytoken-deprecated-in-asp-net-mvc-4-rc
        public string ReportEntity(long entityId, EntityType entityType, string comments, ReportEntityType offenceType)
        {
            var status = string.Empty;

            if (!string.IsNullOrWhiteSpace(comments))
            {
                var report = new ReportEntityDetails()
                {
                    Comment          = comments,
                    ReportEntityID   = entityId,
                    ParentID         = entityId,
                    Status           = OffensiveStatusType.Flagged,
                    ReportedByID     = CurrentUserId,
                    ReportEntityType = offenceType
                };

                switch (entityType)
                {
                case EntityType.Community:
                case EntityType.Folder:
                    _reportEntityService.ReportOffensiveCommunity(report);
                    break;

                case EntityType.Content:
                    _reportEntityService.ReportOffensiveContent(report);
                    break;

                default:
                    break;
                }

                // TODO: Only on succeeded we need to send the notification email.
                SendOffensiveEntityMail(report, entityType);
            }
            return(status);
        }