コード例 #1
0
ファイル: AgendaDataAgendaItem.cs プロジェクト: dev027/Agenda
        /// <inheritdoc/>
        public async Task CreateAgendaItemRecursivelyAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            IAgendaItem agendaItem)
        {
            AgendaItemDto dto = AgendaItemDto.ToDto(agendaItem);

            this.context.AgendaItems.Add(dto);
            Audit.AuditCreate(auditHeader, dto, dto.Id);

            foreach (IAgendaItem child in agendaItem.ChildAgendaItems)
            {
                await this.CreateAgendaItemRecursivelyAsync(
                    who,
                    auditHeader,
                    child);
            }

            if (agendaItem.ParentId == null)
            {
                this.logger.Debug(
                    who,
                    "Saving changes",
                    new { AgendaItemId = agendaItem });
                await this.context.SaveChangesAsync();
            }

            this.logger.ReportExit(who);
        }
コード例 #2
0
ファイル: AgendaDataCommittee.cs プロジェクト: dev027/Agenda
        /// <inheritdoc/>
        public async Task CreateCommitteeAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            ICommittee committee)
        {
            this.logger.ReportEntry(
                who,
                new { Committee = committee });

            CommitteeDto dto = CommitteeDto.ToDto(committee);

            this.context.Committees.Add(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            Audit.AuditCreate(auditHeader, dto, dto.Id);

            this.logger.ReportExit(who);
        }
コード例 #3
0
        /// <inheritdoc />
        public async Task CreateOrganisationAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            IOrganisation organisation)
        {
            this.logger.ReportEntry(
                who,
                new { Organisation = organisation });

            OrganisationDto dto = OrganisationDto.ToDto(organisation);

            this.context.Organisations.Add(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            Audit.AuditCreate(auditHeader, dto, dto.Id);

            this.logger.ReportExit(who);
        }
コード例 #4
0
ファイル: AgendaDataMeeting.cs プロジェクト: dev027/Agenda
        /// <inheritdoc/>
        public async Task CreateMeetingAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            IMeeting meeting)
        {
            this.logger.ReportEntry(
                who,
                new { Meeting = meeting });

            MeetingDto dto = MeetingDto.ToDto(meeting);

            this.context.Meetings.Add(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            Audit.AuditCreate(auditHeader, dto, dto.Id);

            this.logger.ReportExit(who);
        }
コード例 #5
0
        /// <inheritdoc/>
        public async Task CreateAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            ICompetition competition)
        {
            this.logger.LogTrace(
                "ENTRY {Method}(who, organisation) {@Who} {@Competition}",
                nameof(this.CreateAsync),
                who,
                competition);

            CompetitionDto dto = CompetitionDto.ToDto(competition);

            this.context.Competitions.Add(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            Audit.AuditCreate(auditHeader, dto, dto.Id);

            this.logger.LogTrace(
                "EXIT {Method}(who) {@Who}",
                nameof(this.CreateAsync),
                who);
        }