Пример #1
0
        public async Task <Event> CreateEvent(
            Account account,
            AccountSet arbiterAccountSet,
            AccountSet participantsAccountSet,
            EventCondition eventCondition,
            EventRelationType eventRelationType,
            EventBetCondition eventBetCondition,
            string title,
            DateTime startDate,
            DateTime endDate)
        {
            using (this._scopeableFactory.Create())
            {
                var @event = new Event
                {
                    AccountId                = account.Id,
                    Title                    = title,
                    StartDate                = startDate == default(DateTime) ? DateTime.Now : startDate,
                    EndDate                  = endDate,
                    EventRelationTypeId      = eventRelationType.Id,
                    ArbiterAccountSetId      = arbiterAccountSet.GetIdentifier(),
                    ParticipantsAccountSetId = participantsAccountSet.GetIdentifier(),
                    ExpectedEventConditionId = eventCondition.Id,
                    EventBetConditionId      = eventBetCondition.Id
                };

                await this._repositoryEvent.Add(@event);

                return(@event);
            }
        }
Пример #2
0
        public async Task <EventCondition> CreateEventCondition(Account account, string description)
        {
            using (this._scopeableFactory.Create())
            {
                var condition = new EventCondition
                {
                    AccountId   = account.Id,
                    Description = description
                };

                await this._repositoryEventCondition.Add(condition);

                return(condition);
            }
        }