public override Task <BuyTicketsResponse> BuyTickets(BuyTicketsRequest request, ServerCallContext context) { var user = (User)context.GetHttpContext().Items["User"]; if (user == null) { throw new ArgumentNullException(nameof(user)); } return(Task.FromResult(new BuyTicketsResponse { Success = _ticketRepository.BuyTickets(user.Username, request.Count) })); }