1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Threading . Tasks ;
5+ using Microsoft . AspNetCore . Mvc ;
6+ using EJ2CoreSampleBrowser . Models ;
7+ using System . Text . Json . Serialization ;
8+ using System . Text . Json ;
9+
10+ namespace EJ2CoreSampleBrowser . Controllers
11+ {
12+ public partial class FileManagerController : Controller
13+ {
14+ public IActionResult FlatData ( )
15+ {
16+ var permission = new Permission
17+ {
18+ copy = false ,
19+ download = false ,
20+ write = false ,
21+ writeContents = false ,
22+ read = true ,
23+ upload = false ,
24+ message = ""
25+ } ;
26+ var resultData = new List < FileData >
27+ {
28+ new FileData
29+ {
30+ dateCreated = DateTime . Now ,
31+ dateModified = DateTime . Parse ( "2024-01-08T18:16:38.4384894+05:30" ) ,
32+ filterPath = "" ,
33+ hasChild = true ,
34+ id = "0" ,
35+ isFile = false ,
36+ name = "Files" ,
37+ parentId = "" ,
38+ size = 1779448 ,
39+ type = "folder" ,
40+ } ,
41+ new FileData
42+ {
43+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
44+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
45+ filterPath = "\\ " ,
46+ hasChild = false ,
47+ id = "1" ,
48+ isFile = false ,
49+ name = "Documents" ,
50+ parentId = "0" ,
51+ size = 680786 ,
52+ type = "folder" ,
53+ permission = permission
54+ } ,
55+ new FileData
56+ {
57+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
58+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
59+ filterPath = "\\ " ,
60+ hasChild = false ,
61+ id = "2" ,
62+ isFile = false ,
63+ name = "Downloads" ,
64+ parentId = "0" ,
65+ size = 6172 ,
66+ type = "folder"
67+ } ,
68+ new FileData
69+ {
70+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
71+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
72+ filterPath = "\\ " ,
73+ hasChild = false ,
74+ id = "3" ,
75+ isFile = false ,
76+ name = "Music" ,
77+ parentId = "0" ,
78+ size = 20 ,
79+ type = "folder"
80+ } ,
81+ new FileData
82+ {
83+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
84+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
85+ filterPath = "\\ " ,
86+ hasChild = true ,
87+ id = "4" ,
88+ isFile = false ,
89+ name = "Pictures" ,
90+ parentId = "0" ,
91+ size = 228465 ,
92+ type = "folder"
93+ } ,
94+ new FileData
95+ {
96+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
97+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
98+ filterPath = "\\ " ,
99+ hasChild = false ,
100+ id = "5" ,
101+ isFile = false ,
102+ name = "Videos" ,
103+ parentId = "0" ,
104+ size = 20 ,
105+ type = "folder"
106+ } ,
107+ new FileData
108+ {
109+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
110+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
111+ filterPath = "\\ Documents\\ " ,
112+ hasChild = false ,
113+ id = "6" ,
114+ isFile = true ,
115+ name = "EJ2_File_Manager" ,
116+ parentId = "1" ,
117+ size = 12403 ,
118+ type = ".docx"
119+ } ,
120+ new FileData
121+ {
122+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
123+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
124+ filterPath = "\\ Documents\\ " ,
125+ hasChild = false ,
126+ id = "7" ,
127+ isFile = true ,
128+ name = "EJ2_File_Manager" ,
129+ parentId = "1" ,
130+ size = 90099 ,
131+ type = ".pdf"
132+ } ,
133+ new FileData
134+ {
135+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
136+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
137+ filterPath = "\\ Documents\\ " ,
138+ hasChild = false ,
139+ id = "8" ,
140+ isFile = true ,
141+ name = "File_Manager_PPT" ,
142+ parentId = "1" ,
143+ size = 578010 ,
144+ type = ".pptx"
145+ } ,
146+ new FileData
147+ {
148+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
149+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
150+ filterPath = "\\ Documents\\ " ,
151+ hasChild = false ,
152+ id = "9" ,
153+ isFile = true ,
154+ name = "File_Manager" ,
155+ parentId = "1" ,
156+ size = 274 ,
157+ type = ".txt"
158+ } ,
159+ new FileData
160+ {
161+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
162+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
163+ filterPath = "\\ Downloads\\ " ,
164+ hasChild = false ,
165+ id = "10" ,
166+ isFile = true ,
167+ name = "Sample_Work_Sheet" ,
168+ parentId = "2" ,
169+ size = 6172 ,
170+ type = ".xlsx"
171+ } ,
172+ new FileData
173+ {
174+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
175+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
176+ filterPath = "\\ Music\\ " ,
177+ hasChild = false ,
178+ id = "11" ,
179+ isFile = true ,
180+ name = "Music" ,
181+ parentId = "3" ,
182+ size = 10 ,
183+ type = ".mp3"
184+ } ,
185+ new FileData
186+ {
187+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
188+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
189+ filterPath = "\\ Music\\ " ,
190+ hasChild = false ,
191+ id = "12" ,
192+ isFile = true ,
193+ name = "Sample_Music" ,
194+ parentId = "3" ,
195+ size = 10 ,
196+ type = ".mp3"
197+ } ,
198+ new FileData
199+ {
200+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
201+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
202+ filterPath = "\\ Videos\\ " ,
203+ hasChild = false ,
204+ id = "13" ,
205+ isFile = true ,
206+ name = "Demo_Video" ,
207+ parentId = "5" ,
208+ size = 10 ,
209+ type = ".mp4"
210+ } ,
211+ new FileData
212+ {
213+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
214+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
215+ filterPath = "\\ Videos\\ " ,
216+ hasChild = false ,
217+ id = "14" ,
218+ isFile = true ,
219+ name = "Sample_Video" ,
220+ parentId = "5" ,
221+ size = 10 ,
222+ type = ".mp4"
223+ } ,
224+ new FileData
225+ {
226+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
227+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
228+ filterPath = "\\ Pictures\\ " ,
229+ hasChild = false ,
230+ id = "15" ,
231+ isFile = false ,
232+ name = "Employees" ,
233+ parentId = "4" ,
234+ size = 237568 ,
235+ type = "folder" ,
236+ } ,
237+ new FileData
238+ {
239+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
240+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
241+ filterPath = "\\ Pictures\\ Employees\\ " ,
242+ hasChild = false ,
243+ id = "16" ,
244+ isFile = true ,
245+ name = "Albert" ,
246+ parentId = "15" ,
247+ size = 53248 ,
248+ type = ".png" ,
249+ imageUrl = "https://ej2.syncfusion.com/demos/src/avatar/images/pic01.png"
250+ } ,
251+ new FileData
252+ {
253+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
254+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
255+ filterPath = "\\ Pictures\\ Employees\\ " ,
256+ hasChild = false ,
257+ id = "17" ,
258+ isFile = true ,
259+ name = "Nancy" ,
260+ parentId = "15" ,
261+ size = 65536 ,
262+ type = ".png" ,
263+ imageUrl = "https://ej2.syncfusion.com/demos/src/avatar/images/pic02.png"
264+ } ,
265+ new FileData
266+ {
267+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
268+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
269+ filterPath = "\\ Pictures\\ Employees\\ " ,
270+ hasChild = false ,
271+ id = "18" ,
272+ isFile = true ,
273+ name = "Michael" ,
274+ parentId = "15" ,
275+ size = 69632 ,
276+ type = ".png" ,
277+ imageUrl = "https://ej2.syncfusion.com/demos/src/avatar/images/pic03.png"
278+ } ,
279+ new FileData
280+ {
281+ dateCreated = DateTime . Parse ( "2023-11-15T19:02:02.3419426+05:30" ) ,
282+ dateModified = DateTime . Parse ( "2024-01-08T16:55:20.9464164+05:30" ) ,
283+ filterPath = "\\ Pictures\\ Employees\\ " ,
284+ hasChild = false ,
285+ id = "19" ,
286+ isFile = true ,
287+ name = "Robert" ,
288+ parentId = "15" ,
289+ size = 48951 ,
290+ type = ".png" ,
291+ imageUrl = "https://ej2.syncfusion.com/demos/src/avatar/images/pic04.png"
292+ }
293+ } ;
294+ ViewBag . ResultData = resultData ;
295+ return View ( ) ;
296+ }
297+ }
298+
299+ public class Permission
300+ {
301+ public bool copy { get ; set ; }
302+ public bool download { get ; set ; }
303+ public bool write { get ; set ; }
304+ public bool writeContents { get ; set ; }
305+ public bool read { get ; set ; }
306+ public bool upload { get ; set ; }
307+ public string ? message { get ; set ; }
308+ }
309+
310+ public class FileData
311+ {
312+ public DateTime dateCreated { get ; set ; }
313+ public DateTime dateModified { get ; set ; }
314+ public string ? filterPath { get ; set ; }
315+ public bool hasChild { get ; set ; }
316+ public string ? id { get ; set ; }
317+ public bool isFile { get ; set ; }
318+ public string ? name { get ; set ; }
319+ public string ? parentId { get ; set ; }
320+ public int size { get ; set ; }
321+ public string ? type { get ; set ; }
322+ public Permission ? permission { get ; set ; }
323+ public string ? imageUrl { get ; set ; }
324+ }
325+ }
0 commit comments