public void productAdding(CommonClasses.ProductDetail productsAddition) { using (DataEntitiesForBilling entities = new DataEntitiesForBilling()) { entities.ProductDetails.Add(productsAddition); entities.SaveChanges(); } }
public void ProductRemoving(CommonClasses.ProductDetail removeProducts) { using (DataEntitiesForBilling entities = new DataEntitiesForBilling()) { entities.ProductDetails.Attach(removeProducts); entities.ProductDetails.Remove(removeProducts); entities.SaveChanges(); } }
public void RemainingProductsAvailable(CommonClasses.ProductDetail remainingProducts) { using (DataEntitiesForBilling entities = new DataEntitiesForBilling()) { foreach (CommonClasses.ProductDetail productsAvailable in entities.ProductDetails) { if (remainingProducts.productID == productsAvailable.productID && remainingProducts.quantity != productsAvailable.quantity) { productsAvailable.quantity = remainingProducts.quantity; } } entities.SaveChanges(); } }
public void adminProductChange(int userID, CommonClasses.ProductDetail productsAdded) { CommonClasses.AdminProductChanx adminAdded = new CommonClasses.AdminProductChanx(); List <ProductDetail> listOfProducts = dataHandling.productRetrieval(); foreach (ProductDetail productsInStore in listOfProducts) { if (productsInStore.productName.Equals(productsAdded.productName)) { adminAdded.productID = productsInStore.productID; } } adminAdded.userID = userID; adminAdded.productName = productsAdded.productName; adminAdded.price = productsAdded.price; adminAdded.quantity = productsAdded.quantity; dataHandling.adminChanges(adminAdded); }
public string productAdditionToStore(CommonClasses.ProductDetail productsAddingDetails) { if (string.IsNullOrEmpty(productsAddingDetails.productName)) { return("Product Name Should Not Be Empty"); } else if (productsAddingDetails.price == 0) { return("Price Should Not Be Zero"); } else if (productsAddingDetails.quantity == 0) { return("Quantity Should Not Be Zero"); } else { dataHandling.productAdding(productsAddingDetails); return("Product Added SuccessFully"); } }