Exemple #1
0
        public BaseController(IOptionsSnapshot <Configs.Mongo> options, IOptionsSnapshot <Configs.JWT> secret, IHttpContextAccessor httpContextAccessor)
        {
            Options = options;
            Sekrit  = secret;
            Context = httpContextAccessor;
            Token   = null;

            MongoClient = new Databases.Mongo(Options);
            TokenRepo   = new Repositories.Mongo.Token(MongoClient);

            var Headers    = Context.HttpContext.Request.Headers;
            var Authorized = Headers.Where(x => x.Key == "Authorization").Select(x => x.Value).FirstOrDefault();

            Authorization = (string.IsNullOrEmpty(Authorized)) ? "" : ((string)Authorized).Substring(7);
        }
 public OrderController(IOptionsSnapshot <Mongo> options, IOptionsSnapshot <Configs.JWT> secret, IHttpContextAccessor httpContextAccessor) : base(options, secret, httpContextAccessor)
 {
     OrderRepo   = new Repositories.Mongo.Order(MongoClient);
     SessionRepo = new Repositories.Mongo.Token(MongoClient);
 }