示例#1
0
        public async Task <PaymentExpVat> PostPaymentVat(PostPaymentVAT model)
        {
            var output = new PaymentExpVat();

            try
            {
                output.OrderCode          = model.OrderCode;
                output.CompanyName        = model.CompanyName;
                output.TaxCode            = model.TaxCode;
                output.BuyerName          = model.BuyerName;
                output.CompanyAddress     = model.CompanyAddress;
                output.ReceiveBillAddress = model.ReceiveBillAddress;
                output.CreateBy           = Guid.Parse(model.UserId);
                output.CreateDate         = DateTime.Now;
                output.LastEditBy         = Guid.Parse(model.UserId);
                output.LastEditDate       = DateTime.Now;
                output.Email = model.Email;
                PaymentContext.PaymentExpVat.Add(output);
                await PaymentContext.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(output);
        }
示例#2
0
        /// <summary>
        /// Xuất hóa đơn VAT
        /// </summary>
        /// <param name="PostPaymentVAT"></param>
        /// <returns></returns>
        public async Task <PostPaymentVAT> CreateExpVAT(PostPaymentVAT PostPaymentVAT)
        {
            PostPaymentVAT output = new PostPaymentVAT();
            var            jwt    = _httpContextAccessor.HttpContext.User.FindFirst(p => p.Type == "access_token").Value;

            if (jwt != null)
            {
                _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwt);
                string apiUrl   = $"/api/v1/Payment/CreateExpVAT";
                var    userInfo = JsonConvert.DeserializeObject <SumProfileResponseDTO>(_httpContextAccessor.HttpContext.User.FindFirst(p => p.Type == "UserInfomation").Value);
                PostPaymentVAT.UserId = userInfo.UserId;
                var json          = JsonConvert.SerializeObject(PostPaymentVAT, Formatting.Indented);
                var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
                var response      = await _client.PostAsync(apiUrl, stringContent);

                if (response.IsSuccessStatusCode)
                {
                    string responseStream = await response.Content.ReadAsStringAsync();

                    output = JsonConvert.DeserializeObject <PostPaymentVAT>(responseStream);
                }
            }

            return(output);
        }
示例#3
0
        public async Task <IActionResult> CreateExpVAT(PostPaymentVAT PostPaymentVAT)
        {
            var data = await _repoWrapper.UpdateStore.CreateExpVAT(PostPaymentVAT);

            return(Json(data));
        }