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); }
public void Update(ItemCategoryMain ICM) { using (ERPContext context = new ERPContext()) { context.Entry(ICM).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(ItemCategoryMain ICM) { using (ERPContext context = new ERPContext()) { context.ItemCategoryMain.Add(ICM); context.SaveChanges(); } }
public void Remove(int id) { using (ERPContext context = new ERPContext()) { ItemCategoryMain objItemCategoryMain = context.ItemCategoryMain.Find(id); context.ItemCategoryMain.Remove(objItemCategoryMain); context.SaveChanges(); } }