Exemple #1
0
        private async Task Handle(AddSectionCommand addSection)
        {
            var record = new SectionRecord
            {
                Name = addSection.Name
            };

            using (var context = new MySqlDbContext())
            {
                await context.Sections.AddAsync(record);

                await context.SaveChangesAsync();
            }

            await Context.ActorOf <EventRootActor>()
            .Ask <CommandResult>(new SaveSectionEvent(record.Id));

            Sender.Tell(new IdCommandResult(record.Id), Self);
        }
        private async Task Handle(SaveArticleEvent @event)
        {
            SectionRecord        section = null;
            List <ArticleRecord> articles;

            using (var context = new MySqlDbContext())
            {
                section = await context.Sections
                          .FirstOrDefaultAsync(x => x.Id == @event.SectionId);

                articles = context.Articles
                           .Where(x => x.SectionId == @event.SectionId).ToList();
            }

            if (section != null)
            {
                var record = GetRecord(section, articles);

                await UpdateSection(record);
            }

            Sender.Tell(new CommandResult(), Self);
        }
Exemple #3
0
 internal Section(SectionRecord record, int index)
 {
     _record = record;
     _index  = index;
 }
Exemple #4
0
 internal Section(SectionRecord record, int index)
 {
     _record = record;
     _index = index;
 }
Exemple #5
0
 internal DefinitionUpdate(string configKey, bool moved, string updatedXml, SectionRecord sectionRecord) :
     base(configKey, moved, updatedXml)
 {
     SectionRecord = sectionRecord;
 }
        internal DefinitionUpdate(string configKey, bool moved, string updatedXml, SectionRecord sectionRecord) : 
                base(configKey, moved, updatedXml) {

            _sectionRecord = sectionRecord;
        }