/// <summary> /// Deletes a poll answer /// </summary> /// <param name="pollAnswer">Poll answer</param> public virtual void DeletePollAnswer(PollAnswer pollAnswer) { if (pollAnswer == null) throw new ArgumentNullException("pollAnswer"); _pollAnswerRepository.Delete(pollAnswer); //event notification _eventPublisher.EntityDeleted(pollAnswer); }
/// <summary> /// Deletes a poll answer /// </summary> /// <param name="pollAnswer">Poll answer</param> public virtual void DeletePollAnswer(PollAnswer pollAnswer) { if (pollAnswer == null) throw new ArgumentNullException("pollAnswer"); _pollAnswerRepository.Delete(pollAnswer); _cacheManager.RemoveByPattern(POLLS_PATTERN_KEY); //event notification _eventPublisher.EntityDeleted(pollAnswer); }
public ActionResult PollAnswerDelete(PollAnswer answer) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePolls)) return AccessDeniedView(); var pol = _pollService.GetPollById(answer.PollId); var pollAnswer = pol.PollAnswers.Where(x => x.Id == answer.Id).FirstOrDefault(); if (pollAnswer == null) throw new ArgumentException("No poll answer found with the specified id", "id"); pol.PollAnswers.Remove(pollAnswer); _pollService.UpdatePoll(pol); return new NullJsonResult(); }