public JsonResult AddCategory(ItemCategorySub model)
        {
            ItemCategorySub ICS = new ItemCategorySub();

            if (model != null && model.SubCategoryId == 0)
            {
                ICS.SubCategoryId   = model.SubCategoryId;
                ICS.SubCategoryName = model.SubCategoryName;
                ICS.CategoryId      = model.CategoryId;
                ICS.Abb             = model.Abb;
                ICS.Active          = true;
                rep.Add(ICS);
                return(Json(new { success = true, message = "Save Successfully" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                ICS.SubCategoryId   = model.SubCategoryId;
                ICS.SubCategoryName = model.SubCategoryName;
                ICS.CategoryId      = model.CategoryId;
                ICS.Abb             = model.Abb;
                ICS.Active          = true;

                rep.Update(ICS);

                return(Json(new { success = true, message = "Update Successfully" }, JsonRequestBehavior.AllowGet));
            }
        }
 public void Update(ItemCategorySub ICS)
 {
     using (ERPContext context = new ERPContext())
     {
         context.Entry(ICS).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void Add(ItemCategorySub ICS)
 {
     using (ERPContext context = new ERPContext())
     {
         context.ItemCategorySub.Add(ICS);
         context.SaveChanges();
     }
 }
 public void Remove(int id)
 {
     using (ERPContext context = new ERPContext())
     {
         ItemCategorySub objICS = context.ItemCategorySub.Find(id);
         context.ItemCategorySub.Remove(objICS);
         context.SaveChanges();
     }
 }