/// <summary> /// Delete an entity. /// </summary> /// <param name="model"></param> public void Delete(ExpensesTypeViewModel model) { var entity = model.ToEntity(); this._ExpensesTypesRepository.Delete(entity); #region Commit Changes this._unitOfWork.Commit(); #endregion }
/// <summary> /// Add an entity. /// </summary> /// <param name="model"></param> /// <returns></returns> public ExpensesTypeViewModel Add(ExpensesTypeViewModel model) { this.ThrowExceptionIfExist(model); var entity = model.ToEntity(); entity = this._ExpensesTypesRepository.Add(entity); var entityAr = new ExpensesType { Id = entity.Id, Name = model.NameAr, Description = model.DescriptionAr, Language = Framework.Common.Enums.Language.Arabic }; entity.ChildTranslatedExpensesTypes.Add(entityAr); this._ExpensesTypesRepository.Add(entityAr); var entityEn = new ExpensesType { Id = entity.Id, Name = model.NameEn, Description = model.DescriptionEn, Language = Framework.Common.Enums.Language.English }; entity.ChildTranslatedExpensesTypes.Add(entityEn); this._ExpensesTypesRepository.Add(entityEn); #region Commit Changes this._unitOfWork.Commit(); #endregion model = entity.ToModel(); return(model); }