public ActionResult CreateCategory(Categories eCategories) { string message = ""; if (ModelState.IsValid) { try { FASM_Enums.InfoMessages SaveResult = CategoriesBI.SaveCategories(ref eCategories); switch (SaveResult) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.SuccessfulSaved; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "Sorry!the category name already exist"; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } return(View(eCategories)); }
public ActionResult EditCategory(Categories eCategories) { if (eCategories.isLoad == false) { eCategories.CategoryId = Convert.ToInt32(Request.Params["CategoryId"]); CategoriesBI.LoadCategories(ref eCategories); return(PartialView(eCategories)); } else { string message = ""; if (ModelState.IsValid) { try { FASM_Enums.InfoMessages Results = CategoriesBI.SaveCategories(ref eCategories); switch (Results) { case FASM_Enums.InfoMessages.Success: message = FASM_Msg.Updated; break; case FASM_Enums.InfoMessages.AlreadyExist: message = "Sorry!the category name already exist"; break; } return(Json(new { msg = message, JsonRequestBehavior.AllowGet })); } catch (Exception ex) { ViewBag.CatchedMsg = ex.Message; } } } return(View(eCategories)); }