public HistoryViewModel(PetRepository repository, IEventAggregator events) { _repository = repository; _history = repository.History; events.GetEvent <NewPetEvent>().Subscribe(pet => PetsChanged()); events.GetEvent <SoldPetEvent>().Subscribe(pet => PetsChanged()); }
public HistoryViewModel(PetRepository repository, IEventAggregator events) { _repository = repository; _history = repository.History; events.GetEvent<NewPetEvent>().Subscribe(pet => PetsChanged()); events.GetEvent<SoldPetEvent>().Subscribe(pet => PetsChanged()); }
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"); }