Write in front
This article will implement a list of other file types.
Series Articles
[Ef]vs15+ef6+mysql Code First mode
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (1)
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (2)--User Registration
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (3)--Verification code
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (4)--Upload Avatar
[Bootstrap]modal Popup box
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--login interface, avatar and other proportional compression
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--page template
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--ajax mode registration
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (6)--ajax mode login
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (7)--File upload
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (8)--File download, delete
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (9)--Edit file name
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (10)--New Folder
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (11)--New Folder 2
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (12)--new folder and upload file
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (13)--Edit folder
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (14)--Logical reconstruction
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (14)--thinking
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (15)--Logical refactoring 2
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (16)--Logical refactoring 3
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (17)--Thinking 2
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (18)--File upload, download, modify
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (--BJUI) and Ztree
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (--bootstrap) Paginator
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (21)--Network disk operation log
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (22)--image list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (23)--Document list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (24)--Video list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (25)--seed list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (26)--Music list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (27)--Application list
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (28)--Other list
Realize
Here is also very good implementation, because when uploading the file, has been through the file of the icon to distinguish, here to find, just filter by the icon on the line.
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingsystem.web;usingSYSTEM.WEB.MVC;usingSystem.Web.Script.Serialization;usingWolfy.NetDisk.BLL;usingWolfy.NetDisk.IBLL;usingWolfy.NetDisk.Model;usingWolfy.NetDisk.Site.Models;namespacewolfy.netdisk.site.controllers{ Public classOthercontroller:controller {PrivateImyfileservicerepository _myfileservicerepository =Newmyfileservicerepository (); PrivateIlogservicerepository _logservicerepository =Newlogservicerepository (); PrivateIfiletypeservicerepository filetypeservicerepository =Newfiletypeservicerepository (); // //GET:/images/ PublicActionResult Lists () {UserInfo user= session["User"] asUserInfo; if(User = =NULL) { returnRedirecttoaction ("Login","UserInfo"); } returnView (); } [HttpGet] PublicJsonresult getothers () {UserInfo UserInfo= session["User"] asUserInfo; intpage = Convert.ToInt32 (request.params["page"]); if(Page <=0) {page=1; } if(UserInfo = =NULL) {redirecttoaction ("Login","UserInfo"); } intPageSize =Ten; intRecordCount =0; vardocumentpaged = _myfileservicerepository.findpaged<datetime> (page, PageSize, outRecordCount, x = x.user.id = = Userinfo.id && X.isdelete = =false&& (X.fileicon.contains ("Othertype.png")),false, x =X.createdt); intTotalpage = Convert.ToInt32 (math.ceiling (RecordCount *1.0/pageSize)); List<MyFileViewModel> Lstmyfileviewmodel =NewList<myfileviewmodel>(); foreach(varIteminchdocumentpaged) {Lstmyfileviewmodel.add (NewMyfileviewmodel () {Id=item. Id, Fileicon=item. Fileicon, Fileserverurl="/netdisk/"+ Item. FileMd5 +item. Fileext, Name=item. Name, Filethumnailurl=string. Empty, Size=item. FileSize, Dt=item. Createdt}); } return NewJsonresult () {Data =NewJavaScriptSerializer (). Serialize (New{_data = Lstmyfileviewmodel, _code = $, total = Totalpage}), Jsonrequestbehavior =Jsonrequestbehavior.allowget}; } }}
View Code
Front-end Code
@{Viewbag.title="Lists"; Layout="~/views/shared/_layout.cshtml";}<script>$ (function () {varImgElement = $ ('#docmentpage'); varOptions ={size:"Large", Bootstrapmajorversion:3, //Current PageCurrentPage:1, //You can change the number of pages displayedNumberofpages:5, //Total PagesTotalPages:5 }; function Requestserver (pageIndex) {$.getjson ('/other/getothers?page='+PageIndex, function (data) {Console.log (data); Data=json.parse (data); if(Data.total <=PageIndex) {Options.totalpages=PageIndex; } Else{options.totalpages=Data.total; }; $('#dvdocument'). HTML ("'); $('<table class= "table table-bordered table-hover table-striped table-top" id= "Tbdocument" ><tr><th > FileName </th> <th> file size </th><th> creation time </th> </tr></table>'). AppendTo ($ ('#dvdocument'));; for(vari =0; i < data._data.length; i++) { varCurrent =Data._data[i]; $('<TR><TD data-id='+ Current. Id +'>'+ Current. Fileicon +'">'+ Current. Name +'</td><td>'+ Current. Size +'</td><td>'+ Changedateformat (current. DT) +'</td></tr>'). AppendTo ($ ('#tbdocument')); }; Imgelement.bootstrappaginator (options); }); }; function LoadData (pageIndex) {options.onpageclicked=function (E, originalevent, type, page) {//page Number Click eventConsole.log (page); Options.currentpage=page; Requestserver (page); }; Requestserver (PageIndex); Imgelement.bootstrappaginator (options); }; LoadData (1); });</script><divclass="tablecontent"style="width:95%;"Id="dvdocument"></div><div style="width:95%;p osition:relative;margin-top:10px"> <ul id='Docmentpage' class="Bjui-pagefooter"style="margin:0 Auto; margin-left:30%;"></ul></div>
View Code
Test
Summarize
In addition to my sharing function on the page, the other functions are basically implemented.
Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (28)--Other list