MVC+WCF to realize the top and stepping function of video playback

Source: Internet
Author: User

We all know that to do video site must have the top and trample the function of our campus video management system top and stepping to do with the Youku top and stepping the same effect

, let's introduce the function of the top and stepping.

Before the thought is click the Picture button, directly let the display and data in the database are +1, and then refer to the Youku, decided to achieve the "point of the picture

Light "effect, so the original two color buttons to do another two gray buttons, to achieve the picture and the data in time to update the effect.



--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --


I'll make a brief introduction to the implementation below.

Prepare four images of black and white and color (can be repaired with PS Amerto).

The code in view:


<div class= "Ding" style= "cursor:pointer;" >                        <span id=" Dingspan "> @video. videodingcount</span>        </div>        <div class= "Cai" style= "cursor:pointer;" >                        <span id=" Caispan "> @video. Videocaicount</span>        </div>

the img tag places the picture, and the span tag shows the number of plays.

In Controller Method 1, call the method in WCF and return the information for the video playback:

The basic information for querying vedio by GUID is used for the display            GUID GUID = new GUID of the page (str);            list<videoinfo> videoinfolist = new list<videoinfo> ();            Videoinfolist = Videoinfoservice.getplayvideoinfo (GUID);            viewdata["Videoinfo"] = videoinfolist;
     

Controller in Method 2, update the top and trample records, take the top as an example:


#region Update top record updatedingcount () Zhang Zijie 2015-2-12 09:03:34 public        bool Updatedingcount (videoinfo videoinfo)        {            string videoid = request["VideoID"];            String dingcount = request["Dingcount"];             Place the captured Dingcount and vedioid in the entity            videoinfo envideoinfo = new Videoinfo ();            GUID videoid = new GUID (videoid);            int dingcount = Convert.ToInt32 (dingcount);            Envideoinfo. VideoID = videoid;            Envideoinfo. Videodingcount = Dingcount;             BOOL result = Videoinfoservice.updatedingcount (envideoinfo);             return result;        }        #endregion

Implementation methods in WCF:


#region  Update top number  bool Updatedingcount (videoinfo videoinfo) Zhang Zijie 2015-2-12 07:57:02 public        bool Updatedingcount (Videoinfo videoinfo)        {            //Create mapping rules               Mapper.createmap<videoinfo, videoinfoentity> () ;            Create entity collection            videoinfoentity videoinfotmp = new videoinfoentity ();            To convert              videoinfotmp = mapper.map<videoinfoentity> (videoinfotmp);              Videoinfoentity videoinfoentity = videoinfobll.loadenities (U = u.videoid = = Videoinfo. VideoID). ToList (). First ();            Videoinfoentity.videodingcount = Videoinfo. Videodingcount;             BOOL result = Videoinfobll.update (videoinfoentity);             return result;        }        #endregion

After that, the top and stepping functions of the high-end atmosphere are realized.

MVC+WCF to realize the top and stepping function of video playback

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.