protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PosExistsRequirement requirement) { if (!context.User.HasClaim(c => c.Type == Claims.PointOfSaleId)) { context.Fail(); return; } var posId = context.User.GetPointOfSaleId(); var httpResponse = await _posService.StatPointOfSale(posId); if (httpResponse.IsSuccessStatusCode) { context.Succeed(requirement); } else { context.Fail(); } }
protected override async Task <HttpResponseMessage> MakeRequest(Guid id) => await _service.StatPointOfSale(id);