Esempio n. 1
0
        public ActionResult MenuProduct()
        {
            var list = productTypeRepositoryFE.GetAllChildByParent(Convert.ToInt32(Resources.ResourceID.ProductRoot));

            var menu = new MenuProductModel()
            {
                ListProductType = list.Where(t => t.ID != Convert.ToInt32(Resources.ResourceID.ProductRoot)).ToList(),
                RootType        = list.FirstOrDefault(t => t.ID == Convert.ToInt32(Resources.ResourceID.ProductRoot))
            };

            return(View(menu));
        }
        public Task RemoveProduct(MenuProductModel product)
        {
            string sql = "delete from products_table where ProductId=@ProductId";

            return(_db.ExecuteSQLQuery(sql, product));
        }
        public Task UpdateProduct(MenuProductModel product)
        {
            string sql = @"update products_table set ProductName=@ProductName, ProductPrice=@ProductPrice, ProductDescription=@ProductDescription, ProductMarks=@ProductMarks where ProductId=@ProductId";

            return(_db.ExecuteSQLQuery(sql, product));
        }
        public Task <int> AddProduct(MenuProductModel product)
        {
            string sql = "insert into products_table (ProductName, ProductPrice, ProductDescription, ProductMarks) values (@ProductName, @ProductPrice, @ProductDescription, @ProductMarks); select scope_identity()";

            return(_db.InsertDataIntoDatabase(sql, product));
        }