예제 #1
0
        public void Insert(DicValueModel model)
        {
            var entity = new DictionaryValue();

            entity.DictionaryId = model.DicId;
            entity.Code         = model.Code;
            entity.Value        = model.Value;
            _dicManager.InsertOrUpdate(entity);
        }
예제 #2
0
 public ActionResult AddEdit(DicValueModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.Id == 0)
         {
             _dicService.Insert(model);
         }
         else
         {
             _dicService.Update(model);
         }
     }
     return(null);
 }
예제 #3
0
        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);
        }