Exemplo n.º 1
0
        public IHttpActionResult Get()
        {
            string userId = User.Identity.GetUserId();
            //bring from db just the item preview for payment card
            IEnumerable <ItemPreview> paymentCards = EntireItems.GetAllPaymentCards(db, userId);

            return(Ok(paymentCards.GroupItems()));
        }
Exemplo n.º 2
0
        private IEnumerable <ItemPreview> GetAllItems()
        {
            string userId = User.Identity.GetUserId();
            //take passwords
            var items = EntireItems.GetAllPasswords(db, userId)
                        .Union
                            (EntireItems.GetAllWifis(db, userId))
                        .Union
                            (EntireItems.GetAllNotes(db, userId))
                        .Union
                            (EntireItems.GetAllPaymentCards(db, userId));

            //return them
            return(items);
        }
Exemplo n.º 3
0
        private IEnumerable <ItemPreview> SearchItems(string searchString)
        {
            if (string.IsNullOrEmpty(searchString))
            {
                return(null);
            }
            //get current user id
            string userId = User.Identity.GetUserId();
            //get items from db
            var items = EntireItems.GetAllPasswords(db, userId)
                        .Where(s => s.Title.Contains(searchString))
                        .Union//take wifis
                            (EntireItems.GetAllWifis(db, userId))
                        .Where(s => s.Title.Contains(searchString))
                        .Union
                            (EntireItems.GetAllNotes(db, userId))
                        .Where(s => s.Title.Contains(searchString))
                        .Union
                            (EntireItems.GetAllPaymentCards(db, userId))
                        .Where(s => s.Title.Contains(searchString));

            //return them
            return(items);
        }