public async Task <AlarmResult> Handle(DisarmCommand request, CancellationToken cancellationToken) { await _deviceController.Disarm(request.DeviceId); return(new AlarmResult { AlarmState = (await _deviceController.GetState(request.DeviceId)).AlarmState == AccessControl.Contracts.Commands.AlarmState.Armed ? AlarmState.Armed : AlarmState.Disarmed }); }
public async Task <AuthorizeCardResult> Handle(AuthorizeCardCommand request, CancellationToken cancellationToken) { var credentials = await _context.CardCredentials.FirstOrDefaultAsync(x => x.Data.SequenceEqual(request.CardNo)); if (credentials != null) { await _deviceController.Disarm(request.DeviceId); } return(new AuthorizeCardResult(credentials != null)); }