﻿using Microsoft.AspNetCore.Http;

namespace DNCP.DependencyInjectionDemo.Services
{
    public class HttpContextService
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        public HttpContextService(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }

        public HttpContext HttpContext
        {
            get
            {
                if (_httpContextAccessor == null)
                    return null;

                return _httpContextAccessor.HttpContext;
            }
        }
    }
}
