public void Remove(int?Id)
        {
            ProductCatogory dbEntity = db.productCatogory.Find(Id);

            db.productCatogory.Remove(dbEntity);
            db.SaveChanges();
        }
        public IActionResult Create()
        {
            ProductCatogory model = new ProductCatogory();

            model.ProductCatogoryID = 0;
            return(View(model));
        }
 public IActionResult Create(ProductCatogory model)
 {
     if (ModelState.IsValid)
     {
         _ProductCatogory.Add(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
 public IActionResult Delete(int?Id)
 {
     if (Id == null)
     {
         //Written by Reza: Error Handling
         return(NotFound());
     }
     else
     {
         ProductCatogory model = _ProductCatogory.GetProductCatogory(Id);
         return(View(model));
     }
 }
        public void Add(ProductCatogory _ProductCatogory)
        {
            if (_ProductCatogory.ProductCatogoryID == 0)
            {
                db.productCatogory.Add(_ProductCatogory);
                db.SaveChanges();
            }
            else
            {
                var dbEntity = db.productCatogory.Find(_ProductCatogory.ProductCatogoryID);
                dbEntity.ProductCatogoryName = _ProductCatogory.ProductCatogoryName;

                db.SaveChanges();
            }
        }