Exemple #1
0
        public IActionResult ListDebts(int customerId)
        {
            List <InvoiceVO> listResponse = new List <InvoiceVO>();
            var result = _unitOfWork.Invoice.ListInvoicesByCustomer(customerId);

            foreach (InvoiceBean item in result)
            {
                InvoiceVO invoiceVO = new InvoiceVO()
                {
                    codigo  = item.InvoiceId,
                    monto   = item.ResidueTotal,
                    estado  = (item.IsPay ? "1" : "0"),
                    cliente = new CustomerVO()
                    {
                        nombres = item.ContactName,
                        codigo  = item.CustomerId,
                        empresa = item.BusinessName
                    },
                    producto = new ServiceVO()
                    {
                        codigo      = item.serviceid,
                        descripcion = item.description,
                        precio      = item.Price.ToString()
                    }
                };
                listResponse.Add(invoiceVO);
            }
            return(Ok(listResponse));
        }
Exemple #2
0
        public ActionResult <IEnumerable <InvoiceVO> > Get()
        {
            //return Ok(_invoiceService.ListInvoice());

            var invoices = _unitOfWork.Invoice.ListInvoice();

            List <InvoiceVO> response = new List <InvoiceVO>();

            foreach (var item in invoices)
            {
                InvoiceVO obj = new InvoiceVO()
                {
                    cliente = new CustomerVO()
                    {
                        codigo = item.idcustomer
                    },
                    producto = new ServiceVO()
                    {
                        codigo = item.idservice
                    },
                    codigo = item.idinvoice,
                    estado = (item.ispay ? "1" : "0"),
                    monto  = item.residuetotal
                };
                response.Add(obj);
            }


            return(Ok(response));
        }
Exemple #3
0
        public IActionResult ReversePayment([FromBody]  InvoiceVO entity)
        {
            string        response    = _unitOfWork.Invoice.ReversePay(entity.codigo, entity.producto.codigo, entity.cliente.codigo).FirstOrDefault();
            TransactionVO transaction = new TransactionVO();

            if (response == "0000")
            {
                transaction.Code        = response;
                transaction.Description = "Operacion Exitosa";
            }
            else
            {
                transaction.Code        = "1111";
                transaction.Description = "Error en la operacion";
            }
            return(Ok(new { result = transaction.Code, message = transaction.Description }));
        }