//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())); }
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); }
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); }