Beispiel #1
0
        internal static IQueryable <ItemPreview> GetAllNotes(PasswordManagerEntities db, string userId)
        {
            if (db is null || string.IsNullOrEmpty(userId))
            {
                return(null);
            }
            string iconUrl = IconHelper.GetImageUrl(TypeOfItems.Note);

            return(db.Notes
                   .Where(item => item.UserId == userId)
                   .OrderByDescending(p => p.NumOfVisits)
                   .ThenBy(p => p.Name)
                   .Select(item => new ItemPreview()
            {
                Id = item.Id, Title = item.Name, SubTitle = TypeOfItems.Note.ToString(), ItemType = TypeOfItems.Note, IconUrl = iconUrl
            }));
        }
Beispiel #2
0
        internal static IQueryable <ItemPreview> GetAllPaymentCards(PasswordManagerEntities db, string userId)
        {
            if (db is null || string.IsNullOrEmpty(userId))
            {
                return(null);
            }
            string iconUrl  = IconHelper.GetImageUrl(TypeOfItems.PaymentCard);
            string subTitle = TypeOfItems.PaymentCard.ToSampleString();

            return(db.PaymentCards
                   .Where(note => note.UserId == userId)
                   .OrderByDescending(note => note.NumOfVisits)
                   .ThenBy(note => note.Name)
                   .Select(note => new ItemPreview()
            {
                Id = note.Id, Title = note.Name, SubTitle = subTitle, ItemType = TypeOfItems.PaymentCard, IconUrl = iconUrl
            }));
        }