public static VideoModel Create(Video video) { var desc = video.Description ?? ""; if (desc.Length > MAX_DESCRIPTION) { desc = desc.Substring(0, MAX_DESCRIPTION) + "...."; } var res = new VideoModel { Id = video.VideoId, Title = video.Title, Views = video.ViewCount, UploadedBy = video.Uploader, Description = desc }; int dur; if (int.TryParse(video.Media.Duration.Seconds, out dur)) { res.Duration = TimeSpan.FromSeconds(dur).ToString(); } return(res); }
public static VideoModel Create(Video video) { var desc = video.Description ?? ""; if (desc.Length > MAX_DESCRIPTION) desc = desc.Substring(0, MAX_DESCRIPTION) + "...."; var res = new VideoModel { Id = video.VideoId, Title = video.Title, Views = video.ViewCount, UploadedBy = video.Uploader, Description = desc }; int dur; if (int.TryParse(video.Media.Duration.Seconds, out dur)) { res.Duration = TimeSpan.FromSeconds(dur).ToString(); } return res; }