public BaseApiController(IUnitOfWork unitOfWork, IMailHelper mailHelper, IApiClient apiClient, IMyJwtDecoder jwtDecoder, ICache cache)
 {
     uow             = unitOfWork;
     this.apiClient  = apiClient;
     this.mailHelper = mailHelper;
     this.jwtDecoder = jwtDecoder;
     apiClient?.AddDefaultRequestHeader("apiKey", Properties.Settings.Default.jwtKey);
     this.cache = cache;
 }
Beispiel #2
0
        //     public async Task<ActionResult> Invoice(string order_no, string pdfKey)
        //     {
        //if(pdfKey == Properties.Settings.Default.pdfKey)
        //{
        //	var apiClient = new HttpClient();
        //	apiClient.DefaultRequestHeaders.Add("apiKey", Properties.Settings.Default.jwtKey);
        //	var response = await apiClient.GetAsync($"{Properties.Settings.Default.apiUrl}/api/getOrdersForInvoices?order_no={order_no}");
        //	var task = response.Content.ReadAsAsync<Order>();
        //	var order = task.Result;
        //	return View("Invoices" ,new List<Order> { order });
        //}
        //return null;
        //     }

        public async Task <ActionResult> Invoices(string order_nos, string pdfKey)
        {
            if (pdfKey == Properties.Settings.Default.pdfKey)
            {
                apiClient.AddDefaultRequestHeader("apiKey", Properties.Settings.Default.jwtKey);
                var response = await apiClient.GetAsync($"{Properties.Settings.Default.apiUrl}/api/getOrdersForInvoices?order_nos={order_nos}");

                var task = response.Content.ReadAsAsync <List <Order> >();
                return(View(task.Result));
            }
            return(null);
        }