Пример #1
0
        public ActionResult DictioanriesUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] DictionaryTreeItem model)
        {
            var dictionary = UnitOfWork.DictionaryRepository.Get(model.ID);

            dictionary.ParentID     = model.ParentID;
            dictionary.Caption      = model.Caption;
            dictionary.CaptionEng   = model.CaptionEng;
            dictionary.StringCode   = model.StringCode;
            dictionary.IntCode      = model.IntCode;
            dictionary.DecimalValue = model.DecimalValue;
            dictionary.Code         = model.Code;
            dictionary.SortIndex    = model.SortIndex;

            UnitOfWork.DictionaryRepository.Update(dictionary);

            UnitOfWork.Complate();

            if (UnitOfWork.IsError)
            {
                throw new Exception(Resources.Abort);
            }

            return(PartialView("_DictionaryTree", GetTreeViewModel()));
        }
Пример #2
0
        public ActionResult DictioanriesAdd([ModelBinder(typeof(DevExpressEditorsBinder))] DictionaryTreeItem model)
        {
            UnitOfWork.DictionaryRepository.Add(new Dictionary
            {
                ID           = model.ID,
                ParentID     = model.ParentID,
                Caption      = model.Caption,
                CaptionEng   = model.CaptionEng,
                StringCode   = model.StringCode,
                IntCode      = model.IntCode,
                DecimalValue = model.DecimalValue,
                Code         = model.Code,
                SortIndex    = model.SortIndex
            });

            UnitOfWork.Complate();

            if (UnitOfWork.IsError)
            {
                throw new Exception(Resources.Abort);
            }

            return(PartialView("_DictionaryTree", GetTreeViewModel()));
        }