/// <summary> /// Delete a option for corresponding VotingItem /// </summary> /// <param name="input"></param> /// <returns></returns> public override Empty RemoveOption(RemoveOptionInput input) { var votingItem = AssertVotingItem(input.VotingItemId); Assert(votingItem.Sponsor == Context.Sender, "Only sponsor can update options."); Assert(votingItem.Options.Contains(input.Option), "Option doesn't exist."); votingItem.Options.Remove(input.Option); State.VotingItems[votingItem.VotingItemId] = votingItem; return(new Empty()); }
public override Empty RemoveOption(RemoveOptionInput input) { var votingEvent = AssertVotingEvent(input.Topic, input.Sponsor); Assert(votingEvent.Sponsor == Context.Sender, "Only sponsor can update options."); Assert(votingEvent.Options.Contains(input.Option), "Option doesn't exist."); votingEvent.Options.Remove(input.Option); State.VotingEvents[votingEvent.GetHash()] = votingEvent; return(new Empty()); }