Пример #1
0
        public VotingExchange GetExchange(string votingId, string title, string text)
        {
            var exchange = _exchanges.FirstOrDefault(n => n.VotingId == votingId);

            if (exchange == null)
            {
                //var scope = _scopeFactory.CreateScope();
                //var dbContext = scope.ServiceProvider.GetRequiredService<MunityContext>();

                exchange = new VotingExchange()
                {
                    VotingId = votingId,
                    Title    = title,
                    Text     = text
                };
                _exchanges.Add(exchange);
            }
            else
            {
                exchange.Title = title;
                exchange.Text  = text;
            }
            return(exchange);
        }
 public void NotifyUsersToVote(VotingExchange exchange)
 {
     VoteNotified?.Invoke(this, exchange);
 }