public void DeleteVideoShared(int videoId, string userId) { VideoShared dbEntry = context.VideoShared .FirstOrDefault(v => v.VideoId == videoId && v.UserId == userId); if (dbEntry != null) { context.VideoShared.Remove(dbEntry); context.SaveChanges(); } }
public void DeleteVideoSharedId(int id) { VideoShared dbEntry = context.VideoShared .FirstOrDefault(v => v.id == id); if (dbEntry != null) { context.VideoShared.Remove(dbEntry); context.SaveChanges(); } }
public void SaveVideoShared(int videoId, string userId) { VideoShared shared = context.VideoShared .FirstOrDefault(v => v.VideoId == videoId && v.UserId == userId); if (shared == null) { VideoShared dbEntry = new VideoShared { UserId = userId, VideoId = videoId }; context.VideoShared.Add(dbEntry); } context.SaveChanges(); }