public ActionResult SaveCatagory(CategoryModel loCategoryModel) { try { // TODO: Add insert logic here ProductDataContext db = new ProductDataContext(); try { if (loCategoryModel.CategoryID > 0) { db.SP_UpdateCategory(loCategoryModel.CategoryID, loCategoryModel.CategoryName); } else { db.SP_InsertCategory(loCategoryModel.CategoryName); } } catch (Exception ex) { throw; } return(RedirectToAction("Category")); } catch { return(View()); } }