public static int AddUpdateCategory(category ob)
        {
            int _Categoryid = 0;
            using (InventoryEntities db = new InventoryEntities())
            {
                if (ob.id > 0)
                {
                    category temp = db.categories.Where(u => u.id == ob.id).FirstOrDefault();
                    if (temp != null)
                    {
                        temp.id = ob.id;
                        temp.category_name = ob.category_name;

                    }

                }
                else
                {
                    db.categories.Add(ob);
                }
                int x = db.SaveChanges();
                if (x > 0)
                {
                    _Categoryid = ob.id;
                }

            }
            return _Categoryid;
        }
 public static int AddUpdateCategory(category ob)
 {
     return CategoryProvider.AddUpdateCategory(ob);
 }
 public void AddCatagory(object parameter)
 {
     string category_name;
     TextBox tb = (TextBox)parameter;
     category_name = tb.Text;
     if (category_name != "")
     {
         List<category> temp_list = CategoryServices.GetAllCategoryByName(category_name.Trim());
         if (temp_list.Count == 0)
         {
             category ct = new category();
             ct.id = 0;
             ct.category_name = category_name;
             int temp_Category_id = CategoryServices.AddUpdateCategory(ct);
             if (temp_Category_id != 0)
             {
                 InventoryHelper.SuccessAlert("Success", "Category " + category_name + " is Created");
                // MessageBox.Show("Category " + category_name + " is Created");
                 BindGrid();
                 RaisedPropertyChanged("Category");
             }
         }
     }
 }