Exemple #1
0
 public void CopyFrom(VideoToken videoToken)
 {
     VideoId = videoToken.VideoId;
     SenderId = videoToken.SenderId;
     RecipientId = videoToken.RecipientId;
     IsPlayedByRecipient = videoToken.IsPlayedByRecipient;
     Expired = videoToken.Expired;
 }
Exemple #2
0
        public static bool Update(DefaultContext db, VideoToken videoToken)
        {
            int videoTokenId = videoToken.VideoTokenId;
            VideoToken dbVideoToken = GetDetail(db, videoTokenId);
            if (dbVideoToken == null)
                return false;

            dbVideoToken.CopyFrom(videoToken);

            db.SaveChanges();

            return true;
        }
Exemple #3
0
        public static VideoToken Insert(DefaultContext db, int videoId, int senderId, int recipientId)
        {
            var videoToken = new VideoToken
                                 {
                                     Expired = DateTime.Now.AddHours(Properties.Settings.Default.VideoTokenExpirationHours),
                                     VideoId = videoId,
                                     SenderId = senderId,
                                     RecipientId = recipientId
                                 };

            db.VideoTokens.Add(videoToken);

            db.SaveChanges();

            return videoToken;
        }