コード例 #1
0
        public List <License> CreateLicensesWithPurchaseItem(long purchaseItemID, int qtyAdd)
        {
            //Inicialize new List of licenses
            List <License> licenses = new List <License>();

            //Receive the PurchaseItemID from view PurchaseItem/Create
            //and get data from the database
            var  purchaseItem = repositoryPurchaseItem.FindById(purchaseItemID);
            long getStatusID  = repositoryStatus.FindLicenseFirstOnStockID();

            //Create one License for each PurchaseQty and add in the List Licenses
            for (int i = 0; i < qtyAdd; i++)
            {
                License license = new License();
                license.PurchaseItemID = purchaseItemID;
                license.StatusID       = getStatusID;
                licenses.Add(license);
            }

            return(licenses);
        }