public async Task <bool> AddBookmark <T>(T item, SportsType sportsType, PageDetailType bookmarkType) where T : ISQLiteStorable, IBookmarkable, new() { var membershipType = ShinyHost.Resolve <MembershipService>().MemberRoleType; if (MembershipAdvantage.TryGetValue(membershipType, out MembershipAdvantage advantage)) { int limitSize = 0; switch (bookmarkType) { case PageDetailType.Match: limitSize = advantage.MatchBookmarkLimit; break; case PageDetailType.League: limitSize = advantage.LeagueBookmarkLimit; break; case PageDetailType.Team: limitSize = advantage.TeamBookmarkLimit; break; } int curSavedCnt = (await _sqliteService.SelectAllAsync <T>()).Count; if (curSavedCnt < limitSize) // 저장 가능 { item.Order = 0; item.StoredTime = DateTime.UtcNow; item.IsBookmarked = true; var ret = await _sqliteService.InsertOrUpdateAsync <T>(item); Debug.Assert(ret != 0); string message = this.BuildBookmarkMessage(sportsType, bookmarkType); MessagingCenter.Send(this, message, item); UserDialogs.Instance.Toast(LocalizeString.Set_Bookmark); } else { UserDialogs.Instance.Toast(LocalizeString.Bookmark_Inventory_Full); } } else { return(false); } return(true); }
public async Task <List <NotificationInfo> > GetAllNotification(SportsType sportsType, NotificationType notificationType) { var allitems = await _sqliteService.SelectAllAsync <NotificationInfo>(); return(allitems.Where(elem => elem.SportsType == sportsType && elem.NotificationType == notificationType).ToList()); }