public IActionResult Add(DataViewModel.CategoryViewModel categories)
 {
     try
     {
         if (categories.cat_id > 0)
         {
             Category cat = _context.categories.Find(categories.cat_id);
             cat.category = categories.category;
             _context.Update(cat);
             _context.SaveChanges();
             return(Json(new { success = true }));
         }
         else
         {
             Category cat = new Category();
             cat.category = categories.category;
             _context.Add(cat);
             _context.SaveChanges();
             return(Json(new { success = true, cid = cat.cat_id }));
         }
         //  return Json(new { success = false });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public IActionResult IsEnabledDisabled(int id, bool status)
        {
            var sup = _context.suppliers.Find(id);

            if (status == true)
            {
                sup.Status = "enabled";
            }
            else
            {
                sup.Status = "disabled";
            }
            _context.suppliers.Update(sup);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }