public IActionResult UpdatePendingTrx([FromBody] InventoryOutTrxHeader invOutTrx)
        {
            using (var transaction = dbContext.Database.BeginTransaction())
            {
                try
                {
                    InventoryOutTrxHeader findTrxNum = dbContext.InventoryOutTrxHeaders.Find(invOutTrx.TransactionNo);

                    if (findTrxNum != null)
                    {
                        findTrxNum.Status        = invOutTrx.Status;
                        findTrxNum.TransactionNo = invOutTrx.TransactionNo;
                        findTrxNum.IssuedBy      = invOutTrx.IssuedBy;
                        findTrxNum.IssuedDate    = invOutTrx.IssuedDate;
                        findTrxNum.Department    = invOutTrx.Department;
                        findTrxNum.ReferenceNo   = invOutTrx.ReferenceNo;
                        findTrxNum.Remarks       = invOutTrx.Remarks;
                        dbContext.InventoryOutTrxHeaders.Update(findTrxNum);
                        dbContext.SaveChanges();
                        transaction.Commit();
                        return(Json(findTrxNum));
                    }
                    else
                    {
                        throw new Exception($"User Not found with a user ID of '{invOutTrx.TransactionNo}'.");
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    return(BadRequest(GetErrorMessage(ex)));
                }
            }
        }
        public IActionResult Add([FromBody] InventoryOutTrxHeader inventoryOut)
        {
            using (var transaction = dbContext.Database.BeginTransaction())
            {
                try
                {
                    var ivnList = new InventoryOutTrxHeader();

                    ivnList.TransactionNo   = inventoryOut.TransactionNo;
                    ivnList.TransactionDate = inventoryOut.TransactionDate;
                    ivnList.IssuedBy        = "";
                    var dateFromC = "01/01/0001 00:00:00";
                    ivnList.IssuedDate  = DateTime.Parse(dateFromC);
                    ivnList.ReceivedBy  = inventoryOut.ReceivedBy;
                    ivnList.Department  = inventoryOut.Department;
                    ivnList.ReferenceNo = inventoryOut.ReferenceNo;
                    ivnList.Remarks     = inventoryOut.Remarks;
                    ivnList.Status      = inventoryOut.Status;

                    dbContext.InventoryOutTrxHeaders.Add(ivnList);
                    dbContext.SaveChanges();
                    transaction.Commit();
                    return(Ok(inventoryOut));
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    return(BadRequest(GetErrorMessage(ex)));
                }
            }
        }
        public IActionResult DeleteAllTrx(string trxNum)
        {
            using (var transaction = dbContext.Database.BeginTransaction())
            {
                try
                {
                    InventoryOutTrxHeader allTrxHeader = dbContext.InventoryOutTrxHeaders.Find(trxNum);

                    if (allTrxHeader != null)
                    {
                        dbContext.InventoryOutTrxHeaders.Remove(allTrxHeader);
                        dbContext.SaveChanges();
                        transaction.Commit();
                        return(Json(trxNum));
                    }
                    else
                    {
                        throw new Exception($"User Not found with a user ID of '{trxNum}'.");
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    return(BadRequest(GetErrorMessage(ex)));
                }
            }
        }