public void CopyFrom(VideoToken videoToken) { VideoId = videoToken.VideoId; SenderId = videoToken.SenderId; RecipientId = videoToken.RecipientId; IsPlayedByRecipient = videoToken.IsPlayedByRecipient; Expired = videoToken.Expired; }
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; }
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; }