//GET api/Passwords
        public IHttpActionResult Get()//get latest passwords preview
        {
            string userId = User.Identity.GetUserId();
            //bring from db just the item preview for passwords
            IEnumerable <ItemPreview> passwords = EntireItems.GetAllPasswords(db, userId);;

            return(Ok(passwords.GroupItems()));
        }
Exemplo n.º 2
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()));
        }
        //GET api/Wifis
        public IHttpActionResult Get()
        {
            string userId = User.Identity.GetUserId();
            //take all ordered wifis
            IEnumerable <ItemPreview> wifis = EntireItems.GetAllWifis(db, userId);

            return(Ok(wifis.GroupItems()));
        }
Exemplo n.º 4
0
        //GET api/Notes
        public IHttpActionResult Get()
        {
            string userId = User.Identity.GetUserId();
            //bring from db just the item preview for notes
            IEnumerable <ItemPreview> notes = EntireItems.GetAllNotes(db, userId);

            return(Ok(notes.GroupItems()));
        }
Exemplo n.º 5
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.º 6
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);
        }