Exemplo n.º 1
0
        public static UserVideoDto VideoEntity2VideoDTO(this USER_Videos video, int userId, int uses)
        {
            if (video == null)
            {
                return new UserVideoDto {
                           userId = userId
                }
            }
            ;


            var token = new UserVideoDto
            {
                userId       = userId
                , identifier = video.BcIdentifier.ToString()
                , bcid       = video.BcIdentifier.ToString()
                , name       = video.Name
                , title      = video.ShortDescription
                , views      = video.PlaysTotal
                , uses       = uses
                , duration   = video.Length.VideoLength2Duration()
                , minutes    = video.Length.VideoLength2Duration().Duration2HoursString()
                , thumbUrl   = video.BcIdentifier.CombimeVideoUrl(userId, CommonEnums.eVideoPictureTypes.Thumb).ToCloudfrontSignedUrl()
                , stillUrl   = video.BcIdentifier.CombimeVideoUrl(userId, CommonEnums.eVideoPictureTypes.Still).ToCloudfrontSignedUrl()
                , addon      = video.CreationDate
                , tags       = string.IsNullOrEmpty(video.Tags) ? new string[0] : video.Tags.Split(Convert.ToChar(","))
                , millisec   = video.Length
                , status     = ImportJobsEnums.eFileInterfaceStatus.Transferred
            };

            token.tagsStr = token.tags.StringsList2String();

            return(token);
        }
Exemplo n.º 2
0
        /// <summary>
        /// save video from edit window
        /// </summary>
        /// <param name="videoDTO">videoDTO equal to field in EditVideoToken </param>
        /// <returns></returns>
        public JsonResult SaveVideo(UserVideoDto videoDTO)
        {
            string error;
            var    saved = BaseAuthorServices.SaveVideo(videoDTO, out error);

            return(Json(new JsonResponseToken
            {
                success = saved
                , error = error
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult DestroyVideo([DataSourceRequest] DataSourceRequest request, UserVideoDto dto)
        {
            string error;

            if (dto == null)
            {
                return(Json(ModelState.ToDataSourceResult()));
            }

            if (dto.fileId != null && dto.fileId >= 0)
            {
                BaseAuthorServices.DeleteWaitingVideo((int)dto.fileId, out error);
            }
            else
            {
                if (dto.identifier != null)
                {
                    BaseAuthorServices.DeleteVideo(long.Parse(dto.identifier), out error);
                }
            }

            return(Json(ModelState.ToDataSourceResult()));
        }