Ejemplo n.º 1
0
        public void DeleteProduct(Product p)
        {
            try
            {
                // Remove from DB
                PersistencyService.DeleteProductAsync(p);

                // Remove from List
                ProductList.Remove(p);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        public void DeleteProduct(Product p)
        {
            if (p.OrderList != null || p.ProductReturns != null && (p.OrderList.Count > 0 || p.ProductReturns.Count > 0))
            {
                throw new ArgumentException("Kan ikke slette produktet, da det indeholder Ordre/Returns");
            }

            try
            {
                // Remove from DB
                PersistencyService.DeleteProductAsync(p);

                // Remove from List
                ProductList.Remove(p);

                new MessageDialog("Produkt er slettet").ShowAsync();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }
        }