public IHttpActionResult PostCategory([FromBody] COMCategory com)
        {
            COMCategory c = BLLcategory.GetCategoryById(com.CategoryId);

            if (c != null)
            {
                return(BadRequest("category already exist"));
            }
            BLLcategory.AddCategory(com, Form1.categoriesCounter);
            return(Ok());
        }
Beispiel #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            COMCategory cat = new COMCategory();

            cat.CategoryName = textBox6.Text;
            cat.ImageURL     = path;
            BLLcategory.AddCategory(cat, categoriesCounter);
            int catId = BLLcategory.GetCategoryIdByCategoryName(cat.CategoryName);

            try
            {
                BLLcategory.UpdateURL(catId, BLLgoogleVision.Storage(catId, cat.ImageURL, categoriesCounter, true));
            }
            catch (Exception)
            {
                throw;
            }
            groupBox2.Visible = false;
            textBox6.Text     = string.Empty;
        }