예제 #1
0
        public JsonResult AddCategory(ItemCategoryMain model)
        {
            ItemCategoryMain ICM = new ItemCategoryMain();

            if (model != null && model.CategoryId == 0)
            {
                ICM.CategoryId   = model.CategoryId;
                ICM.CategoryName = model.CategoryName;
                ICM.Abb          = model.Abb;
                ICM.BranchId     = 4;
                ICM.Active       = true;
                rep.Add(ICM);
                return(Json(new { success = true, message = "Save Successfully" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                ICM.CategoryId   = model.CategoryId;
                ICM.CategoryName = model.CategoryName;
                ICM.Abb          = model.Abb;
                ICM.BranchId     = 4;
                ICM.Active       = true;
                rep.Update(ICM);

                return(Json(new { success = true, message = "Update Successfully" }, JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
예제 #2
0
 public void Update(ItemCategoryMain ICM)
 {
     using (ERPContext context = new ERPContext())
     {
         context.Entry(ICM).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #3
0
 public void Add(ItemCategoryMain ICM)
 {
     using (ERPContext context = new ERPContext())
     {
         context.ItemCategoryMain.Add(ICM);
         context.SaveChanges();
     }
 }
예제 #4
0
 public void Remove(int id)
 {
     using (ERPContext context = new ERPContext())
     {
         ItemCategoryMain objItemCategoryMain = context.ItemCategoryMain.Find(id);
         context.ItemCategoryMain.Remove(objItemCategoryMain);
         context.SaveChanges();
     }
 }