public async Task Handle(UpdateTest command) { Check.NotNull(command, nameof(command)); var test = await _testStore.GetById(command.Id); if (test == null) { throw new TestNotFoundException(command.Id); } test.Update(command.Id, command.Name, command.Description, command.TestType); await this._testStore.Save(test); }
public async Task Handle(DeleteTest command) { Check.NotNull(command, nameof(command)); var test = await _testStore.GetById(command.Id); if (test == null) { throw new TestNotFoundException(command.Id); } if (test.IsDeleted) { throw new TestAlreadyDeletedException(command.Id); } test.Delete(command.Id); await this._testStore.Save(test); }