public async Task <List <HearderTable> > GetPOHeaders()
        {
            List <HearderTable> listaHeader = new List <HearderTable>();

            if (_context != null)
            {
                var headerList = await(from h in _context.POHeader
                                       join c in _context.customerCatalog on h.CustomeridCustomer equals c.idCustomer
                                       join s in _context.statusOrder on h.StatusPurchaseOrderidStatus equals s.idStatus
                                       select new
                {
                    h.idPO
                    ,
                    c.CustomerName
                    ,
                    s.StatusName
                    ,
                    h.OrderDate
                }).ToListAsync();

                if (headerList != null)
                {
                    foreach (var item in headerList)
                    {
                        HearderTable headerTable = new HearderTable();

                        headerTable.idPo      = item.idPO;
                        headerTable.Customer  = item.CustomerName;
                        headerTable.Status    = item.StatusName;
                        headerTable.OrderDate = item.OrderDate;
                        listaHeader.Add(headerTable);
                    }
                }

                return(listaHeader);
            }

            return(null);
        }
        public async Task <HearderTable> GetPOHeaderById(int id)
        {
            HearderTable headerTable = new HearderTable();

            if (id > 0)
            {
                var headerList = await(from h in _context.POHeader
                                       join c in _context.customerCatalog on h.CustomeridCustomer equals c.idCustomer
                                       join s in _context.statusOrder on h.StatusPurchaseOrderidStatus equals s.idStatus
                                       where h.idPO == id
                                       select new
                {
                    h.idPO
                    ,
                    c.CustomerName
                    ,
                    s.StatusName
                    ,
                    h.OrderDate
                }).ToListAsync();

                if (headerList != null)
                {
                    foreach (var item in headerList)
                    {
                        headerTable.idPo      = item.idPO;
                        headerTable.Customer  = item.CustomerName;
                        headerTable.Status    = item.StatusName;
                        headerTable.OrderDate = item.OrderDate;
                    }
                }

                return(headerTable);
            }
            return(null);
        }