public async Task <OffensiveEntityDetailsList> GetOffensiveContents() { Collection <OffensiveEntityDetails> entities = new Collection <OffensiveEntityDetails>(); ProfileDetails profileDetails; if (ValidateAuthentication(true, out profileDetails)) { IProfileService profileService = DependencyResolver.Current.GetService(typeof(IProfileService)) as IProfileService; profileDetails = profileService.GetProfile(profileDetails.PUID); if (profileDetails != null) { IReportEntityService entityService = DependencyResolver.Current.GetService(typeof(IReportEntityService)) as IReportEntityService; var contents = await entityService.GetOffensiveContents(profileDetails.ID); entities = new Collection <OffensiveEntityDetails>(contents.ToList()); } else { throw new WebFaultException <string>(Resources.UserNotRegisteredMessage, HttpStatusCode.Unauthorized); } } return(new OffensiveEntityDetailsList() { Entities = entities }); }
public bool DeleteOffensiveCommunityEntry(string id) { bool status = false; ProfileDetails profileDetails; if (ValidateAuthentication(true, out profileDetails)) { IProfileService profileService = DependencyResolver.Current.GetService(typeof(IProfileService)) as IProfileService; profileDetails = profileService.GetProfile(profileDetails.PUID); if (profileDetails != null) { IReportEntityService entityService = DependencyResolver.Current.GetService(typeof(IReportEntityService)) as IReportEntityService; var details = new OffensiveEntry() { EntryID = long.Parse(id, CultureInfo.InvariantCulture), ReviewerID = profileDetails.ID, Status = OffensiveStatusType.Reviewed }; status = entityService.UpdateOffensiveCommunityEntry(details).Succeeded; } else { throw new WebFaultException <string>(Resources.UserNotRegisteredMessage, HttpStatusCode.Unauthorized); } } return(status); }
/// <summary> /// Initializes a new instance of the OffensiveController class. /// </summary> /// <param name="reportEntityService">Instance of reportEntity Service</param> /// <param name="profileService">Instance of profile Service</param> public OffensiveController(IReportEntityService reportEntityService, IProfileService profileService, INotificationService notificationService) : base(profileService) { _reportEntityService = reportEntityService; _notificationService = notificationService; }