public void Delete(ExcludeViewModel model) { var entity = model.ToEntity(); this._ExcludesRepository.Delete(entity); #region Commit Changes this._unitOfWork.Commit(); #endregion }
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(); }
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); }
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); }