Exemple #1
0
        public async Task <IResponseOutput> AddImageAsync(DocumentAddImageInput input)
        {
            var entity = Mapper.Map <DocumentImageEntity>(input);
            var id     = (await _documentImageRepository.InsertAsync(entity)).Id;

            return(ResponseOutput.Result(id > 0));
        }
Exemple #2
0
        public async Task <IResponseOutput> AddAsync(ApiAddInput input)
        {
            var entity = Mapper.Map <ApiEntity>(input);
            var id     = (await _apiRepository.InsertAsync(entity)).Id;

            return(ResponseOutput.Result(id > 0));
        }
Exemple #3
0
        public async Task <IResponseOutput> AddAsync(RoleAddInput input)
        {
            var entity = _mapper.Map <RoleEntity>(input);
            var id     = (await _roleRepository.InsertAsync(entity)).Id;

            return(ResponseOutput.Result(id > 0));
        }
Exemple #4
0
        public async Task <IResponseOutput> AddAsync(DictionaryAddInput input)
        {
            var dictionary = _mapper.Map <DictionaryEntity>(input);
            var id         = (await _dictionaryRepository.InsertAsync(dictionary)).Id;

            return(ResponseOutput.Result(id > 0));
        }
        public async Task<IResponseOutput> UpdateBasicAsync(UserUpdateBasicInput input)
        {
            var entity = await _userRepository.GetAsync(input.Id);
            entity = _mapper.Map(input, entity);
            var result = (await _userRepository.UpdateAsync(entity)) > 0;

            return ResponseOutput.Result(result);
        }
Exemple #6
0
        public async Task <IResponseOutput> BatchSoftDeleteAsync(long[] ids)
        {
            var result = await _roleRepository.SoftDeleteAsync(ids);

            await _rolePermissionRepository.DeleteAsync(a => ids.Contains(a.RoleId));

            return(ResponseOutput.Result(result));
        }
Exemple #7
0
        public async Task <IResponseOutput> SoftDeleteAsync(long id)
        {
            var result = await _roleRepository.SoftDeleteAsync(id);

            await _rolePermissionRepository.DeleteAsync(a => a.RoleId == id);

            return(ResponseOutput.Result(result));
        }
Exemple #8
0
        public async Task <IResponseOutput> SoftDeleteAsync(long id)
        {
            var result = await _userRepository.SoftDeleteAsync(id);

            await _userRoleRepository.DeleteAsync(a => a.UserId == id);

            return(ResponseOutput.Result(result));
        }
        public async Task<IResponseOutput> DeleteAsync(long id)
        {
            var result = false;
            if (id > 0)
            {
                result = (await _userRepository.DeleteAsync(m => m.Id == id)) > 0;
            }

            return ResponseOutput.Result(result);
        }
Exemple #10
0
        public async Task <IResponseOutput> DeleteImageAsync(long documentId, string url)
        {
            var result = false;

            if (documentId > 0 && url.NotNull())
            {
                result = (await _documentImageRepository.DeleteAsync(m => m.DocumentId == documentId && m.Url == url)) > 0;
            }

            return(ResponseOutput.Result(result));
        }
Exemple #11
0
        public async Task <IResponseOutput> UpdateBasicAsync(UserUpdateBasicInput input)
        {
            var entity = await _userRepository.GetAsync(input.Id);

            entity = Mapper.Map(input, entity);
            var result = (await _userRepository.UpdateAsync(entity)) > 0;

            //清除用户缓存
            await Cache.DelAsync(string.Format(CacheKey.UserInfo, input.Id));

            return(ResponseOutput.Result(result));
        }
Exemple #12
0
        public async Task <IResponseOutput> BatchSoftDeleteAsync(long[] ids)
        {
            //删除用户
            await _userRepository.SoftDeleteAsync(a => ids.Contains(a.TenantId.Value), "Tenant");

            //删除角色
            await _roleRepository.SoftDeleteAsync(a => ids.Contains(a.TenantId.Value), "Tenant");

            //删除租户
            var result = await _tenantRepository.SoftDeleteAsync(ids);

            return(ResponseOutput.Result(result));
        }
Exemple #13
0
        public async Task <IResponseOutput> SoftDeleteAsync(long id)
        {
            //删除用户
            await _userRepository.SoftDeleteAsync(a => a.TenantId == id, "Tenant");

            //删除角色
            await _roleRepository.SoftDeleteAsync(a => a.TenantId == id, "Tenant");

            //删除租户
            var result = await _tenantRepository.SoftDeleteAsync(id);

            return(ResponseOutput.Result(result));
        }
        public async Task <IResponseOutput> UpdateApiAsync(PermissionUpdateApiInput input)
        {
            var result = false;

            if (input != null && input.Id > 0)
            {
                var entity = await _permissionRepository.GetAsync(input.Id);

                entity = _mapper.Map(input, entity);
                result = (await _permissionRepository.UpdateAsync(entity)) > 0;
            }

            return(ResponseOutput.Result(result));
        }
Exemple #15
0
        public async Task <IResponseOutput> UpdateGroupAsync(DocumentUpdateGroupInput input)
        {
            var result = false;

            if (input != null && input.Id > 0)
            {
                var entity = await _DocumentRepository.GetAsync(input.Id);

                entity = _mapper.Map(input, entity);
                result = (await _DocumentRepository.UpdateAsync(entity)) > 0;
            }

            return(ResponseOutput.Result(result));
        }
Exemple #16
0
        public async Task <IResponseOutput> AddAsync(OprationLogAddInput input)
        {
            string ua     = _context.HttpContext.Request.Headers["User-Agent"];
            var    client = UAParser.Parser.GetDefault().Parse(ua);
            var    device = client.Device.Family;

            device            = device.ToLower() == "other" ? "" : device;
            input.Browser     = client.UA.Family;
            input.Os          = client.OS.Family;
            input.Device      = device;
            input.BrowserInfo = ua;

            input.NickName = _user.NickName;
            input.IP       = IPHelper.GetIP(_context?.HttpContext?.Request);

            var entity = _mapper.Map <OprationLogEntity>(input);
            var id     = (await _oprationLogRepository.InsertAsync(entity)).Id;

            return(ResponseOutput.Result(id > 0));
        }
        public async Task<IResponseOutput> ChangePasswordAsync(UserChangePasswordInput input)
        {
            if (input.ConfirmPassword != input.NewPassword)
            {
                return ResponseOutput.NotOk("新密码和确认密码不一致!");
            }

            var entity = await _userRepository.GetAsync(input.Id);
            var oldPassword = MD5Encrypt.Encrypt32(input.OldPassword);
            if (oldPassword != entity.Password)
            {
                return ResponseOutput.NotOk("旧密码不正确!");
            }

            input.Password = MD5Encrypt.Encrypt32(input.NewPassword);

            entity = _mapper.Map(input, entity);
            var result = (await _userRepository.UpdateAsync(entity)) > 0;

            return ResponseOutput.Result(result);
        }
Exemple #18
0
        public async Task <IResponseOutput> SoftDeleteAsync(long id)
        {
            var result = await _roleRepository.SoftDeleteAsync(id);

            return(ResponseOutput.Result(result));
        }
Exemple #19
0
        public async Task <IResponseOutput> BatchSoftDeleteAsync(long[] ids)
        {
            var result = await _userRepository.SoftDeleteAsync(ids);

            return(ResponseOutput.Result(result));
        }