//ConfigChoiceCategory #region ConfigChoiceCategory public ActionResult ConfigChoiceCategoryList() { ConfigChoiceCategoryModel cccModel = new ConfigChoiceCategoryModel(); cccModel.ConfigChoiceCategoryList = _iSetupService.GetConfigChoiceCategoryList(); return(View(cccModel)); }
public ActionResult CreateEditConfigChoiceCategory(int?CategoryId) { ConfigChoiceCategoryModel cccModel = new ConfigChoiceCategoryModel(); if (CategoryId != null) { cccModel = _iSetupService.GetConfigChoiceCategoryList().Where(x => x.CategoryId == CategoryId).FirstOrDefault(); } return(PartialView("_CreateEditConfigChoiceCategory", cccModel)); }
public ActionResult CreateEditConfigChoiceCategory(ConfigChoiceCategoryModel cccModel) { if (ModelState.IsValid) { var result = _iSetupService.CreateEditConfigChoiceCategory(cccModel); return(Json(result, JsonRequestBehavior.AllowGet)); } else { return(Json(rModel, JsonRequestBehavior.AllowGet)); } }
public ReturnMessageModel CreateEditConfigChoiceCategory(ConfigChoiceCategoryModel iModel) { try { var cccRow = _context.ConfigChoiceCategories.Where(x => x.CategoryId == iModel.CategoryId).FirstOrDefault(); if (cccRow == null) { cccRow = new ConfigChoiceCategory(); } cccRow.Category = iModel.Category; cccRow.CategoryNepali = iModel.CategoryNepali; cccRow.CategoryDescription = iModel.CategoryDescription; cccRow.IsActive = iModel.IsActive; if (cccRow.CategoryId == 0) { _context.ConfigChoiceCategories.Add(cccRow); _context.SaveChanges(); } else { _context.ConfigChoiceCategories.Attach(cccRow); _context.Entry(cccRow).State = EntityState.Modified; _context.SaveChanges(); } rModel.Msg = "ConfigChoiceCategory Saved Successfully!!"; rModel.Success = true; return(rModel); } catch (Exception ex) { rModel.Msg = "ConfigChoiceCategory Save Failed!!"; rModel.Success = false; return(rModel); } }