Esempio n. 1
0
 public void AddRoleGroup(RoleGroup roleGroup)
 {
     //roleGroup.Note = "0";
     roleGroup.isDelete = false;
     _roleGroupRepository.Add(roleGroup);
     _unitOfWork.Commit();
 }
Esempio n. 2
0
        public RoleGroupDTO Add(RoleGroupDTO roleGroupDTO)
        {
            var roleGroup = roleGroupDTO.ToModel();

            roleGroup.Id      = IdentityGenerator.NewSequentialGuid();
            roleGroup.Created = DateTime.UtcNow;

            if (roleGroup.Name.IsNullOrBlank())
            {
                throw new DefinedException(UserSystemMessagesResources.Name_Empty);
            }

            if (_Repository.Exists(roleGroup))
            {
                throw new DataExistsException(string.Format(UserSystemMessagesResources.RoleGroup_Exists_WithValue, roleGroup.Name));
            }

            _Repository.Add(roleGroup);

            #region 操作日志

            var roleGroupDto = roleGroup.ToDto();

            OperateRecorder.RecordOperation(roleGroupDto.Id.ToString(),
                                            UserSystemMessagesResources.Add_RoleGroup,
                                            roleGroupDto.GetOperationLog());

            #endregion

            //commit the unit of work
            _Repository.UnitOfWork.Commit();

            return(roleGroup.ToDto());
        }
Esempio n. 3
0
        public RoleGroupDTO Add(RoleGroupDTO roleGroupDTO)
        {
            var roleGroup = roleGroupDTO.ToModel();

            roleGroup.Id      = IdentityGenerator.NewSequentialGuid();
            roleGroup.Created = DateTime.UtcNow;

            if (roleGroup.Name.IsNullOrBlank())
            {
                throw new DataExistsException(UserSystemResource.Common_Name_Empty);
            }

            if (_Repository.Exists(roleGroup))
            {
                throw new DataExistsException(UserSystemResource.RoleGroup_Exists);
            }

            _Repository.Add(roleGroup);

            //commit the unit of work
            _Repository.UnitOfWork.Commit();

            return(roleGroup.ToDto());
        }