Exemplo n.º 1
0
 public CurPageViewModel(bool IsMySelf)
 {
     UserGrantSelectList = new ObservableCollection <SelectObj <User> >();
     CollectNotes        = new ObservableCollection <Lib.Note>();
     if (IsMySelf)
     {
         SearchCondition = new NoteSearch()
         {
             PageIndex = 1,
             PageSize  = 15,
             IsMySelft = "Yes",
             UserId    = AppSet.LoginUser.Id
         };
     }
     else
     {
         SearchCondition = new NoteSearch()
         {
             PageIndex = 1,
             PageSize  = 15,
             IsMySelft = "No",
             UserId    = AppSet.LoginUser.Id
         };
     }
     CanVisible = "Collapsed";
 }
Exemplo n.º 2
0
        public IActionResult GetAllNotesBySearchObject([FromBody] NoteSearch search)
        {
            IQueryable <Notes> query;

            if (search.DirectoryId != 0 && !search.DirectFilterIds.Any())
            {
                query = _noteService.GetAllNotesUnderDirectory_Query(search.DirectoryId);
            }
            else if (search.DirectoryId != 0 && search.DirectFilterIds.Any())
            {
                query = _noteService.GetAllNotesUnderDirectory_TagFilter_Query(search.DirectoryId, search.DirectFilterIds);
            }
            else if (search.DirectoryId == 0 && search.DirectFilterIds.Any())
            {
                query = _noteService.GetAllNotes_TagFilter_Query(search.DirectFilterIds);
            }
            else
            {
                return(BadRequest(search));
            }

            var notesResponse = _dbHelper.GetObjectsByQuery <Notes, NoteSummary>(query);

            if (notesResponse.ReturnCode == ReturnCode.NoEntitiesMatchQuery)
            {
                notesResponse.ReturnCode = ReturnCode.Success;
            }

            return(ApiResult(notesResponse));
        }
Exemplo n.º 3
0
        public IList <SNote> Search(NoteSearch search)
        {
            var notes = NoteRepository
                        .GetList(n =>
                                 (search.BookId == null || n.BookId == search.BookId) &&
                                 (search.NoteTitle == null || n.Title.Contains(search.NoteTitle)) &&
                                 (search.NoteDescription == null || n.Description.Contains(search.NoteDescription)))
                        .Select(SNote.DtoS)
                        .ToList();

            return(notes);
        }
Exemplo n.º 4
0
        public NoteSearch SortByDate()
        {
            var books = BookRepository.GetAll();

            books.Insert(0, null);
            var noteSearch = new NoteSearch
            {
                Notes = NoteRepository.GetAll().Select(SNote.DtoS).ToList(),
                Books = new SelectList(books, "Id", "Title")
            };

            return(noteSearch);
        }
Exemplo n.º 5
0
        public ActionResult Search(NoteSearch search)
        {
            var notes = NoteService.Search(search);

            return(PartialView(notes));
        }