コード例 #1
0
        public virtual int Save(M model)
        {
            var validation = Validate(model);

            if (!"[]".Equals(validation))
            {
                throw new Exception(validation);
            }
            int result;

            if (model.Id == 0)
            {
                model.CreatedBy = (MVCHISSession.Instance.CurrentUser == null ? "SYSTEM" : MVCHISSession.Instance.CurrentUser.UserName);
                model.CreatedOn = (DateTime.Now);
                result          = BaseEntity.Create(model);
            }
            else
            {
                model.UpdatedBy = (MVCHISSession.Instance.CurrentUser == null ? "SYSTEM" : MVCHISSession.Instance.CurrentUser.UserName);
                model.UpdatedOn = (DateTime.Now);
                result          = BaseEntity.Update(model, "Id");
                //if (keyvals.ContainsKey(model.Id)) keyvals.Remove(model.Id);
            }
            OnSaveAction?.Invoke(result);
            //dtGetKeysAndValues = null;
            return(result);
        }
コード例 #2
0
        public AddEditNoteViewModel()
        {
            var canSave = this.WhenAny(x => x.Name, x => !string.IsNullOrWhiteSpace(x.Value));

            SaveCommand = ReactiveCommand.Create(() =>
            {
                OnSaveAction?.Invoke();
                FinishInteraction?.Invoke();
            }, canSave);

            CancelCommand = ReactiveCommand.Create(() => FinishInteraction?.Invoke());
        }
コード例 #3
0
        public SetFilterValueViewModel()
        {
            filtersDictionary = FiltersHelper.GetFiltersObjects().ToDictionary(x => x.Filter, x => x.Description);

            SaveCommand = ReactiveCommand.Create(() =>
            {
                OnSaveAction?.Invoke();
                FinishInteraction?.Invoke();
            });

            CancelCommand = ReactiveCommand.Create(() =>
            {
                OnCancelAction?.Invoke();
                FinishInteraction?.Invoke();
            });
        }