コード例 #1
0
 public HistoryViewModel(PetRepository repository, IEventAggregator events)
 {
     _repository = repository;
     _history    = repository.History;
     events.GetEvent <NewPetEvent>().Subscribe(pet => PetsChanged());
     events.GetEvent <SoldPetEvent>().Subscribe(pet => PetsChanged());
 }
コード例 #2
0
ファイル: HistoryViewModel.cs プロジェクト: pako4u2k/wipflash
 public HistoryViewModel(PetRepository repository, IEventAggregator events)
 {
     _repository = repository;
     _history = repository.History;
     events.GetEvent<NewPetEvent>().Subscribe(pet => PetsChanged());
     events.GetEvent<SoldPetEvent>().Subscribe(pet => PetsChanged());
 }
コード例 #3
0
ファイル: Create.cs プロジェクト: Orjanen/Db_Kvarteret
            public async Task <Unit> Handle(Command request, CancellationToken cancellationToken)
            {
                var history = new Domain.History
                {
                    GroupName = request.GroupName,
                    Position  = request.Position,
                    GroupType = request.GroupType,
                    Year      = request.Year
                };

                _context.Historys.Add(history);

                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(Unit.Value);
                }

                throw new Exception("problem saving changes");
            }