コード例 #1
0
        public void Delete(ExcludeViewModel model)
        {
            var entity = model.ToEntity();

            this._ExcludesRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
コード例 #2
0
        public void ThrowExceptionIfExist(ExcludeViewModel model)
        {
            //ConditionFilter<Exclude, long> condition = new ConditionFilter<Exclude, long>
            //{
            //	Query = (entity =>
            //		entity.Name == model.Name &&
            //		entity.Id != model.Id)
            //};
            //var existEntity = this._ExcludesRepository.Get(condition).FirstOrDefault();

            //if (existEntity != null)
            //	throw new ItemAlreadyExistException();
        }
コード例 #3
0
        public ExcludeViewModel Add(ExcludeViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._ExcludesRepository.Add(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }
コード例 #4
0
        public ExcludeViewModel Update(ExcludeViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = this._ExcludesRepository.Get(model.Id);

            //entity.LocationId = model.LocationId;
            //entity.AccountChartId = model.AccountChartId;

            entity = this._ExcludesRepository.Update(entity);


            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion

            model = entity.ToModel();
            return(model);
        }