//public virtual double GetPercentSupport(Suggestion suggestion) //{ // var support = GetVoteCount(suggestion, true); // var opposition = GetVoteCount(suggestion, false); // var abstentions = GetAbstentionCount(suggestion); // if ((support + opposition+ abstentions) == 0) { return 0; } // return Math.Round( (100.0 * (support-opposition)) / (support + opposition+ abstentions),1); // throw new NotImplementedException(); //} public ResponseResource DeleteSuggestion(IPrincipal principal, DeleteSugestionRequest request) { var user = _dependencies.UserService.GetGuaranteedAuthenticatedUser(principal); var suggestion = GetGuaranteedSuggestion(request.SuggestionId); var member = _dependencies.OrganisationService.GetGuaranteedMember(principal, suggestion.AuthorMember.OrganisationId); if (suggestion.AuthorMemberId != member.Id) { _dependencies.OrganisationService.GuaranteeUserHasPermission(user, member.Organisation, ShurahOrganisationPermission.RemoveSuggestion); } _dependencies.StorageService.SetOf <Suggestion>().Remove(suggestion); _dependencies.StorageService.SaveChanges(); return(new ResponseResource()); }
public ResponseResource Post(DeleteSugestionRequest request) { return(_service.DeleteSuggestion(User, request)); }
public HttpResponseMessage Post(DeleteSugestionRequest request) { return(Request.CreateResponse(HttpStatusCode.OK, _service.DeleteSuggestion(User, request))); }