public SaveResult <VocabularyViewModel> Save(VocabularyViewModel model, bool saveChanges)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var        result = new SaveResult <VocabularyViewModel>();
            Vocabulary vocabulary;

            if (model.Id == Guid.Empty)
            {
                vocabulary = this._manager.CreateVocabulary(model.Name, model.Culture);
            }
            else
            {
                vocabulary = this._manager.GetVocabulary(model.Id);
                model.Map <Vocabulary>(vocabulary);
            }

            result.Success = vocabulary != null;

            if (result.Success && saveChanges)
            {
                this._source.SaveChanges();
            }

            result.Entity = vocabulary;
            return(result);
        }
        public VocabularyViewModel Get(Guid?id)
        {
            VocabularyViewModel model;

            if (!id.HasValue)
            {
                model = new VocabularyViewModel();
            }
            else
            {
                model = this._manager.GetVocabulary(id.Value).Map <VocabularyViewModel>();
            }

            return(model);
        }
 public SaveResult <VocabularyViewModel> Save(VocabularyViewModel model)
 {
     return(this.Save(model, true));
 }
        public VocabularyViewModel Get(Guid? id)
        {
            VocabularyViewModel model;

            if (!id.HasValue)
            {
                model = new VocabularyViewModel();
            }
            else
            {
                model = this._manager.GetVocabulary(id.Value).Map<VocabularyViewModel>();
            }

            return model;
        }
        public SaveResult<VocabularyViewModel> Save(VocabularyViewModel model, bool saveChanges)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var result = new SaveResult<VocabularyViewModel>();
            Vocabulary vocabulary;

            if (model.Id == Guid.Empty)
            {
                vocabulary = this._manager.CreateVocabulary(model.Name, model.Culture);
            }
            else
            {
                vocabulary = this._manager.GetVocabulary(model.Id);
                model.Map<Vocabulary>(vocabulary);
            }

            result.Success = vocabulary != null;

            if (result.Success && saveChanges)
            {
                this._source.SaveChanges();
            }

            result.Entity = vocabulary;
            return result;
        }
 public SaveResult<VocabularyViewModel> Save(VocabularyViewModel model)
 {
     return this.Save(model, true);
 }