예제 #1
0
        public Resp_Binary Modify(SysRoleDTO model)
        {
            var sysrole = model.GetPrototype <SysRoleDTO, SysRole>();
            var entity  = _sysRoleRepository.GetById(sysrole.ID);

            if (entity == null)
            {
                return new Resp_Binary {
                           message = "用户角色不存在"
                }
            }
            ;

            entity.Name        = sysrole.Name;
            entity.Description = sysrole.Description;
            entity.CreateTime  = sysrole.CreateTime;
            entity.Creater     = sysrole.Creater;

            _sysRoleRepository.Update(entity);
            if (_sysRoleRepository.UnitOfWork.Commite() > 0)
            {
                return(Resp_Binary.Modify_Sucess);
            }

            return(Resp_Binary.Modify_Failed);
        }
예제 #2
0
        public Resp_Binary Create(SysRoleDTO model)
        {
            var sysrole = model.GetPrototype <SysRoleDTO, SysRole>();

            if (_sysRoleRepository.GetByWhere(t => t.Name == sysrole.Name).FirstOrDefault().IsNotNull())
            {
                return new Resp_Binary {
                           message = "角色名已存在"
                }
            }
            ;
            _sysRoleRepository.Insert(sysrole);
            if (_sysRoleRepository.UnitOfWork.Commite() > 0)
            {
                return(Resp_Binary.Add_Sucess);
            }

            return(Resp_Binary.Add_Failed);
        }