I am calculating the total length of my video and watch video length in seconds.
When I click on the button in my ASP.NET MVC page called in which I passed the data
Total Length: 131
Total Watch: 233
Here total length means my video "total length" is 233 seconds and "Total watch" means I have watched 131 seconds video.
233 Seconds means: 3.53 (Min: Sec)
131 Seconds means: 2.11 (Min: Sec)
Now in my database, I have to convert the SECONDS into minutes and then insert the data.
So I have used this code:
ViewDuration = Math.Round((myModel.myWatchCount / 60), 2),
VideoLength = Math.Round((myModel.VideoLength / 60), 2),
Pass the value ViewDuration
and VideoLength
in the database table.
It shows me
Video Length : - 3.88
Video Duration: - 2.18
What's wrong with the above code? Please suggest?
Edit Code Here is my MVC Controller. How I assign the value to my Class Field.
StudentInfo uvi = new StudentInfo()
{
ViewDuration = Math.Round((myModel.myWatchCount / 60), 2),
VideoLength = Math.Round((myModel.VideoLength / 60), 2)
}