//ConfigChoice #region ConfigChoice public ActionResult ConfigChoiceList(int catId) { ConfigChoiceModel cccModel = new ConfigChoiceModel(); cccModel.ConfigChoiceList = _iSetupService.GetConfigChoiceList(catId); cccModel.CategoryId = catId; cccModel.CategoryName = CommonService.GetConfigChoiceCategoryById(catId).Category; return(View(cccModel)); }
public ActionResult CreateEditConfigChoice(int categoryId, int?choiceId) { ConfigChoiceModel cccModel = new ConfigChoiceModel(); if (choiceId != null) { cccModel = _iSetupService.GetConfigChoiceList(categoryId).Where(x => x.ChoiceId == choiceId).FirstOrDefault(); } return(PartialView("_CreateEditConfigChoice", cccModel)); }
public ActionResult CreateEditConfigChoice(ConfigChoiceModel cccModel) { if (ModelState.IsValid) { var result = _iSetupService.CreateEditConfigChoice(cccModel); return(Json(result, JsonRequestBehavior.AllowGet)); } else { return(Json(rModel, JsonRequestBehavior.AllowGet)); } }
public static ConfigChoiceModel GetConfigChoiceModel(int choiceId) { using (PointOfSaleEntities _context = new PointOfSaleEntities()) { ConfigChoiceModel model = new ConfigChoiceModel(); model = _context.ConfigChoices.Where(x => x.ChoiceId == choiceId).Select(x => new ConfigChoiceModel { ChoiceId = x.ChoiceId, Choice = x.Choice }).FirstOrDefault(); return(model); } }
public ReturnMessageModel CreateEditConfigChoice(ConfigChoiceModel model) { try { var ccRow = _context.ConfigChoices.Where(x => x.ChoiceId == model.ChoiceId).FirstOrDefault(); if (ccRow == null) { ccRow = new ConfigChoice(); } ccRow.CategoryId = model.CategoryId; ccRow.Choice = model.Choice; ccRow.ChoiceNepali = model.ChoiceNepali; ccRow.ChoiceDescription = model.ChoiceDescription; ccRow.Val = model.Val; ccRow.IsActive = model.IsActive; if (ccRow.ChoiceId == 0) { _context.ConfigChoices.Add(ccRow); _context.SaveChanges(); } else { _context.ConfigChoices.Attach(ccRow); _context.Entry(ccRow).State = EntityState.Modified; _context.SaveChanges(); } rModel.Msg = "ConfigChoice Saved Successfully!!"; rModel.Success = true; return(rModel); } catch (Exception ex) { rModel.Msg = "ConfigChoice Save Failed!!"; rModel.Success = false; return(rModel); } }