예제 #1
0
        public async Task Remove(CommandSoucastRemove cmd)
        {
            var remove = db.Soucasti.FirstOrDefault(u => u.SoucastId == cmd.SoucastId);

            if (remove != null)
            {
                var ev = new EventSoucastRemoved()
                {
                    Generation = remove.Generation + 1,
                    EventId    = Guid.NewGuid(),
                    SoucastId  = cmd.SoucastId,
                };
                db.Soucasti.Remove(remove);
                await _handler.PublishEvent(ev, MessageType.SoucastRemoved, ev.EventId, remove.EventGuid, remove.Generation, remove.SoucastId);

                await db.SaveChangesAsync();
            }
        }
예제 #2
0
 public async Task Delete(CommandSoucastRemove cmd)
 {
     await _repository.Remove(cmd);
 }