Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (27)--Music list

Source: Internet
Author: User
Tags mysql code

Write in front

This article will implement the list of applications, as well as the other lists, depending on the query criteria.

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)--Music list

Realize

Whether the query is added or is filtered by the icon that corresponds to the file.

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 classExescontroller: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 Getapks () {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 ("Apktype.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}; }    }}

Front

<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 ('/exes/getapks?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

Not much nonsense, all in the code.

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (27)--Music list

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.