Ejemplo n.º 1
0
        /// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(AdvancesTypeViewModel model)
        {
            var entity = model.ToEntity();

            this._AdvancesTypesRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add an entity.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public AdvancesTypeViewModel Add(AdvancesTypeViewModel model)
        {
            this.ThrowExceptionIfExist(model);

            var entity = model.ToEntity();

            entity = this._AdvancesTypesRepository.Add(entity);

            var entityAr = new AdvancesType
            {
                Name     = model.NameAr,
                Language = Framework.Common.Enums.Language.Arabic,
                ParentKeyAdvancesTypes = entity
            };

            entity.ChildTranslatedAdvancesTypes.Add(entityAr);
            this._AdvancesTypesRepository.Add(entityAr);

            var entityEn = new AdvancesType
            {
                Name     = model.NameEn,
                Language = Framework.Common.Enums.Language.English,
                ParentKeyAdvancesTypes = entity
            };

            entity.ChildTranslatedAdvancesTypes.Add(entityEn);
            this._AdvancesTypesRepository.Add(entityEn);


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

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