예제 #1
0
        public void InsertEnterpriseFile(EnterpriseFileInput input)
        {
            var userClaim = _userService.UserClaim();

            _enterpriseFileRepository.InsertAsync(new EnterpriseFileEntity
            {
                Id           = Guid.NewGuid(),
                CreateUserId = userClaim.UserId,
                FileId       = (Guid)input.FileId,
                UserId       = input.EnterpriseId.HasValue ? input.EnterpriseId : userClaim.UserId
            });
        }
예제 #2
0
        public void DeleteEnterpriseFile([FromUri] EnterpriseFileInput input)
        {
            var userClaim      = _userService.UserClaim();
            var enterpriseId   = input.EnterpriseId.HasValue ? input.EnterpriseId : userClaim.UserId;
            var enterpriseFile = _enterpriseFileRepository.FirstOrDefault(t => t.UserId == enterpriseId && t.FileId == input.FileId && t.IsDeleted == false);

            if (enterpriseFile != null)
            {
                enterpriseFile.IsDeleted    = true;
                enterpriseFile.UpdateTime   = Clock.Now;
                enterpriseFile.UpdateUserId = userClaim.UserId;
                _enterpriseFileRepository.UpdateAsync(enterpriseFile);

                var file = _fileRepository.FirstOrDefault(t => t.IsDeleted == false && t.Id == input.FileId);
                if (file != null)
                {
                    file.IsDeleted    = true;
                    file.UpdateTime   = Clock.Now;
                    file.UpdateUserId = userClaim.UserId;
                    _fileRepository.UpdateAsync(file);
                }
            }
        }