public IHttpActionResult SaveReceiptVoucher(ReceiptPaymentVoucherAC resource)
        {
            int companyId      = MerchantContext.CompanyDetails.Id;
            var receiptVoucher = _receiptPaymentVoucherRepository.SaveReceiptVoucher(resource, companyId);

            return(Ok(receiptVoucher));
        }
Beispiel #2
0
        public ReceiptPaymentVoucher SaveReceiptVoucher(ReceiptPaymentVoucherAC receiptPaymentVoucherAc, int companyId)
        {
            try
            {
                var receiptPaymentVoucher = new ReceiptPaymentVoucher
                {
                    BranchId        = 1,
                    IsReceipt       = receiptPaymentVoucherAc.IsReceipt,
                    Narration       = receiptPaymentVoucherAc.Narration,
                    TotalAmount     = receiptPaymentVoucherAc.TotalAmount,
                    CreatedDateTime = DateTime.UtcNow,
                    AccountId       = receiptPaymentVoucherAc.AccountId,
                    BankName        = receiptPaymentVoucherAc.BankName,
                    BankBranch      = receiptPaymentVoucherAc.BankBranch,
                    ChequeNo        = receiptPaymentVoucherAc.ChequeNo,
                    ParamTypeId     = receiptPaymentVoucherAc.ParamTypeId,
                    ReceivedFromId  = receiptPaymentVoucherAc.ReceivedFromId,
                    ChequeDate      = receiptPaymentVoucherAc.ChequeDate,
                    companyId       = companyId
                };
                _receiptPaymnetContext.Add(receiptPaymentVoucher);
                _receiptPaymnetContext.SaveChanges();

                SaveReceiptVoucherDetail(receiptPaymentVoucherAc.ReceiptPaymentDetail, receiptPaymentVoucher.Id);

                return(receiptPaymentVoucher);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }