Example #1
0
        public async Task Remove(CommandNastaveniRemove cmd)
        {
            var remove = db.Nastaveni.FirstOrDefault(u => u.PravidloId == cmd.NastaveniId);

            if (remove != null)
            {
                var ev = new EventNastaveniDeleted()
                {
                    Generation  = remove.Generation + 1,
                    EventId     = Guid.NewGuid(),
                    NastaveniId = cmd.NastaveniId,
                };
                db.Nastaveni.Remove(remove);
                await _handler.PublishEvent(ev, MessageType.NastaveniRemoved, ev.EventId, remove.EventGuid, remove.Generation, remove.PravidloId);

                await db.SaveChangesAsync();
            }
        }
 public async Task Delete(CommandNastaveniRemove cmd)
 {
     await _repository.Remove(cmd);
 }