public void DeleteFav(TVshow tvshow) { for (int i = Favourite.Count - 1; i >= 0; i--) { if (tvshow == Favourite[i]) { Favourite.RemoveAt(i); } } }
//Перевірка чи є введений час вільний public bool CheckTime(DateTime start, double duration, int idshow) { TVshow AddShow = tvshowList[TVshowIndexByID(idshow)]; DateTime end = start.AddMinutes(duration); foreach (Date i in dateList) { TVshow CurrShow = tvshowList[TVshowIndexByID(i.Id)]; if (CurrShow.ChanelName == AddShow.ChanelName && (start <= i.EndTime) && (end >= i.StartTime)) { return(false); } } return(true); }
public void AddFav(TVshow tvshow) { bool x = false; foreach (TVshow i in Favourite) { if (tvshow == i) { x = true; break; } } if (!x) { Favourite.Add(tvshow); } }
//заповнення тестовими даними public void FillTestData(int n) { //Date Date date; dateList.Clear(); for (int i = n; i >= 0; i--) { date = new Date(new DateTime(2020, 6, 20, 7, i, i), i, i); dateList.Add(date); } // TVshow TVshow tvshow; tvshowList.Clear(); for (int i = n; i >= 0; i--) { tvshow = new TVshow($"TVshowName{i}", $"TVshowGenre{i}", $"ChanelName{i}", i); tvshowList.Add(tvshow); } // User User user; userList.Clear(); for (int i = 0; i <= n; i++) { user = new User($"Login{i}", $"Pass{i}"); try { user.Favourite.Add(tvshowList[i]); } catch { continue; } userList.Add(user); } }
//індексація телешоу public void AddTVshow(TVshow tvshow) { tvshow.Id = tvshowList.Max(p => p.Id) + 1; tvshowList.Add(tvshow); }