public void Insert(DicValueModel model) { var entity = new DictionaryValue(); entity.DictionaryId = model.DicId; entity.Code = model.Code; entity.Value = model.Value; _dicManager.InsertOrUpdate(entity); }
public ActionResult AddEdit(DicValueModel model) { if (ModelState.IsValid) { if (model.Id == 0) { _dicService.Insert(model); } else { _dicService.Update(model); } } return(null); }
public DicValueModel GetDicValueModel(int?dicId, int?itemId) { DicValueModel model = null; if (itemId.HasValue) { var dicValue = GetDictionaryValue(dicId.Value, itemId.Value); model = new DicValueModel() { Code = dicValue.Code, DicId = dicId.Value, Id = itemId.Value, Value = dicValue.Value }; } else { model = new DicValueModel() { DicId = dicId.Value }; } return(model); }