public JsonResult SaveSubCategory(SubCategory subCategory) { string message = ""; bool savedSuccessfully = true; try { if (subCategory != null) { if (subCategory.SubCategoryId > 0) { SubCategoryDbModel.UpdateSubCategory(subCategory); message = "Sub Category updated successfully"; } else { SubCategoryDbModel.SaveSubCategory(subCategory); message = "Sub Category created successfully"; } } else { message = "Kindly provide valid information, contact to application admin"; savedSuccessfully = false; } } catch (Exception ex) { message = ex.Message; savedSuccessfully = false; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } return(Json(new { SaveMessage = message, IsSuccess = savedSuccessfully })); }
public ActionResult GetSubCategory(int productCategoryId) { List <SubCategory> categoryCollection = SubCategoryDbModel.GetAllSubCategoryFromDBForSpecificCategoryId(productCategoryId); return(Json(new { html = ViewRenderer.RenderPartialToString(this.ControllerContext, "SubCategories", new ViewDataDictionary(categoryCollection), new TempDataDictionary()) }, JsonRequestBehavior.AllowGet)); //return View("SubCategories",categoryCollection); }
public JsonResult GetSubCategoryDetail(int subCategoryId) { SubCategoryItem subCategoryViewModel = new SubCategoryItem(); try { subCategoryViewModel = SubCategoryDbModel.GetSubCategoryItem(subCategoryId); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } return(Json(subCategoryViewModel, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteSubCategory(int subCategoryId) { string message = "Sub category deleted successfuly"; try { SubCategoryDbModel.DeleteSubCategory(subCategoryId); } catch (Exception ex) { message = ex.Message; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } return(Json(new { DeleteMessage = message })); }
public ActionResult CreateSubMenu() { SubCategoryCollection subCategoryCollection = SubCategoryDbModel.GetSubCategoryCollection(); return(View("SubCategory", subCategoryCollection)); }