Example #1
0
        public GalleryRepository(WebGalleryApiClient client, IHttpContextAccessor httpContext)
        {
            _client = client?.Client ?? throw new ArgumentNullException(nameof(client));

            //AddUserContextToApiClient();

            void AddUserContextToApiClient()
            {
                var user   = httpContext.HttpContext.User;
                var userId = user.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;

                if (!string.IsNullOrWhiteSpace(userId))
                {
                    _client.DefaultRequestHeaders.Add("Gallery-User", userId);
                }
            }
        }
 public MetadataRepository(WebGalleryApiClient client)
 {
     _client = client.Client;
 }
 public PictureRepository(WebGalleryApiClient client)
 {
     _client = client?.Client ?? throw new ArgumentNullException(nameof(client));
 }
Example #4
0
 public TagRepository(WebGalleryApiClient client)
 {
     _client = client.Client;
 }