예제 #1
0
        /// <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
        /// <inheritdoc/>
        public async Task UpdateAgendaItemAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            IAgendaItem agendaItem)
        {
            this.logger.ReportEntry(
                who,
                new { AgendaItem = agendaItem });

            AgendaItemDto dto      = AgendaItemDto.ToDto(agendaItem);
            AgendaItemDto original = await this.context.FindAsync <AgendaItemDto>(agendaItem.Id);

            Audit.AuditUpdate(auditHeader, dto.Id, original, dto);

            this.context.Entry(original).CurrentValues.SetValues(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            this.logger.ReportExit(who);
        }
예제 #3
0
 public AgendaItemDto UpdateAgendaItem(AgendaItemDto agendaItemDto)
 {
     return _agendaItemsService.UpdateAgendaItem(agendaItemDto);
 }
예제 #4
0
 public AgendaItemDto AddAgendaItem(AgendaItemDto agendaItem)
 {
     Log.Debug("POST " + System.Reflection.MethodBase.GetCurrentMethod().Name + " called");
     return _agendaItemsService.AddAgendaItem(agendaItem);
 }