public static bool EkleGuncelleVideo(Videolar v) { try { using (var db = new VideoTanitimEntities()) { if (v.videoId < 0) { db.Videolars.Add(v); db.SaveChanges(); return(true); } var video = db.Videolars.Where(_v => _v.videoId == v.videoId).FirstOrDefault(); video.videoYoutubeLinki = v.videoYoutubeLinki; video.videoUrl = v.videoUrl; video.videoAd = v.videoAd; video.videoKapak = v.videoKapak; video.kategoriId = v.kategoriId; video.eklenmeTarihi = v.eklenmeTarihi; video.videoAciklama = v.videoAciklama; db.SaveChanges(); return(true); } } catch (Exception) { throw; } }
public static bool arttirHit(Videolar video) { try { using (var db = new VideoTanitimEntities()) { var v = db.Videolars.Where(_v => _v.videoId == video.videoId).FirstOrDefault(); v.izlenmeSayisi++; db.SaveChanges(); return(true); } } catch (Exception) { throw; } }
public static bool silVideo(Videolar v) { try { using (var db = new VideoTanitimEntities()) { var video = db.Videolars.Where(_v => _v.videoId == v.videoId).FirstOrDefault(); video.aktif = false; db.SaveChanges(); return(true); } } catch (Exception) { throw; } }