Ejemplo n.º 1
0
        /// <summary>
        /// Поиск и продажа товара
        /// </summary>
        /// <param name="product">Товар</param>
        /// <returns>Логическое значение</returns>
        public static bool Sales(Product product)
        {
            var x = ProductMethods.GetItem(product.Id);

            if (x != null)
            {
                x.Status     = false;
                x.DateOfSale = DateTime.Now;
                return(ProductMethods.SaveChanges());
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Поиск и продажа товара
        /// </summary>
        /// <param name="productName">Название товара</param>
        /// <param name="Price">Цена товара</param>
        /// <returns>Логическое значение</returns>
        public static bool Sales(string productName, decimal Price)
        {
            var x = from m in ProductMethods.Outpoot()
                    where productName == m.Name
                    where Price == m.Price
                    orderby m.DateOfPurchase
                    select m;

            if (x != null)
            {
                var f = x.First();
                f.Status     = false;
                f.DateOfSale = DateTime.Now;
                return(ProductMethods.SaveChanges());
            }
            else
            {
                return(false);
            }
        }