@@ -38,59 +38,64 @@ namespace DotNetNuke.Modules.ActiveForums.Controllers
3838 /// <summary>
3939 /// Controller for managing Attachments in the DNN Community Forums module.
4040 /// </summary>
41- internal class AttachmentController : DotNetNuke . Modules . ActiveForums . Controllers . RepositoryControllerBase < DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo >
41+ internal class AttachmentController : RepositoryServiceLocatorBase < DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo , IAttachmentController , AttachmentController > , IAttachmentController
4242 {
4343 private readonly DotNetNuke . Services . FileSystem . IFolderManager folderManager ;
4444 private readonly DotNetNuke . Services . FileSystem . IFileManager fileManager ;
45- private readonly DotNetNuke . Modules . ActiveForums . Controllers . ContentController contentController ;
45+ private readonly DotNetNuke . Modules . ActiveForums . Controllers . IContentController contentController ;
46+
47+ protected override Func < IAttachmentController > GetFactory ( )
48+ {
49+ return ( ) => new AttachmentController ( ) ;
50+ }
4651
4752 public AttachmentController ( )
4853 : this (
4954 DotNetNuke . Services . FileSystem . FolderManager . Instance ,
5055 DotNetNuke . Services . FileSystem . FileManager . Instance ,
51- new DotNetNuke . Modules . ActiveForums . Controllers . ContentController ( ) )
56+ DotNetNuke . Modules . ActiveForums . Controllers . ContentController . Instance )
5257 {
5358 }
5459
5560 public AttachmentController (
5661 DotNetNuke . Services . FileSystem . IFolderManager folderManager ,
5762 DotNetNuke . Services . FileSystem . IFileManager fileManager ,
58- DotNetNuke . Modules . ActiveForums . Controllers . ContentController contentController )
63+ DotNetNuke . Modules . ActiveForums . Controllers . IContentController contentController )
5964 {
6065 this . folderManager = folderManager ;
6166 this . fileManager = fileManager ;
6267 this . contentController = contentController ;
6368 }
6469
65- internal IEnumerable < DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo > GetByContentId ( int contentId )
70+ public IEnumerable < DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo > GetByContentId ( int contentId )
6671 {
67- return this . Find ( "WHERE ContentId = @0" , contentId ) ;
72+ return this . _repositoryControllerBase . Find ( "WHERE ContentId = @0" , contentId ) ;
6873 }
6974
7075 internal new void Delete ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
7176 {
72- base . Delete ( attachmentInfo ) ;
77+ this . _repositoryControllerBase . Delete ( attachmentInfo ) ;
7378 }
7479
75- internal new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Insert ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
80+ public new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Insert ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
7681 {
77- base . Insert ( attachmentInfo ) ;
78- return this . GetById ( attachmentInfo . AttachmentId ) ;
82+ this . _repositoryControllerBase . Insert ( attachmentInfo ) ;
83+ return this . _repositoryControllerBase . GetById ( attachmentInfo . AttachmentId ) ;
7984 }
8085
81- internal new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Update ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
86+ public new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Update ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
8287 {
83- base . Update ( attachmentInfo ) ;
84- return this . GetById ( attachmentInfo . AttachmentId ) ;
88+ this . _repositoryControllerBase . Update ( attachmentInfo ) ;
89+ return this . _repositoryControllerBase . GetById ( attachmentInfo . AttachmentId ) ;
8590 }
8691
87- internal new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Save ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
92+ public new DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo Save ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachmentInfo )
8893 {
89- this . Save ( attachmentInfo , attachmentInfo . AttachmentId ) ;
90- return this . GetById ( attachmentInfo . AttachmentId ) ;
94+ this . _repositoryControllerBase . Save ( attachmentInfo , attachmentInfo . AttachmentId ) ;
95+ return this . _repositoryControllerBase . GetById ( attachmentInfo . AttachmentId ) ;
9196 }
9297
93- internal void RelocateAttachment ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachment )
98+ public void RelocateAttachment ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachment )
9499 {
95100 if ( attachment == null )
96101 {
@@ -99,7 +104,7 @@ internal void RelocateAttachment(DotNetNuke.Modules.ActiveForums.Entities.Attach
99104
100105 DotNetNuke . Services . FileSystem . IFileInfo file = null ;
101106
102- var content = this . contentController . GetById ( attachment . ContentId , DotNetNuke . Common . Utilities . Null . NullInteger ) ;
107+ var content = this . contentController . GetById ( DotNetNuke . Common . Utilities . Null . NullInteger , attachment . ContentId ) ;
103108 if ( content != null )
104109 {
105110 if ( attachment . DisplayInline == true )
@@ -185,7 +190,7 @@ internal void RelocateAttachment(DotNetNuke.Modules.ActiveForums.Entities.Attach
185190 }
186191 }
187192
188- internal void RelocateInlineAttachment ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachment , DotNetNuke . Modules . ActiveForums . Entities . ContentInfo content )
193+ public void RelocateInlineAttachment ( DotNetNuke . Modules . ActiveForums . Entities . AttachmentInfo attachment , DotNetNuke . Modules . ActiveForums . Entities . ContentInfo content )
189194 {
190195 if ( attachment == null || attachment . DisplayInline == false )
191196 {
0 commit comments