Example #1
0
            public async Task <Unit> Handle(Data request, CancellationToken cancellationToken)
            {
                var vehicle = _vehiclesRepository.GetSingle(request.Id);

                if (vehicle == null)
                {
                    throw new Exception("no record found");
                }
                _vehiclesRepository.Delete(vehicle);

                var result = await _vehiclesRepository.Commit();

                if (result > 0)
                {
                    return(Unit.Value);
                }

                throw new Exception("Records were not saved");
            }