Ejemplo n.º 1
0
        /// <summary>
        /// Пользователь нажимает кнопку купить
        /// </summary>
        /// <param name="p_type"></param>
        /// <returns></returns>
        public ContentResult Buy(string p_type)
        {
            string res = "";

            try
            {
                ProductTypes type    = (ProductTypes)Enum.Parse(typeof(ProductTypes), p_type);
                Product      product = new Product(type);
                if (vwWallet.Buy(product.Info.Price))
                {
                    productCatalog.Remove(type);
                    res = "<div class=\"alert alert-success\" role=\"alert\">Спасибо!</div>";
                }
                else
                {
                    res = "<div class=\"alert alert-danger\" role=\"alert\">Недостаточно средств</div>";
                }
            }
            catch { }
            return(Content(res));
        }