Exemple #1
0
        public static List <NoteDM> GetAll(NoteFilter filter)
        {
            List <NoteDM> notes = GetAll();

            if (filter.MinDate != default(DateTime))
            {
                notes = notes.Where(n => n.CreationDate >= filter.MinDate).ToList();
            }
            if (filter.MaxDate != default(DateTime))
            {
                notes = notes.Where(n => n.CreationDate <= filter.MaxDate).ToList();
            }
            if (!string.IsNullOrWhiteSpace(filter.Authors))
            {
                string[] authors = filter.Authors.Split(';');
                notes = notes.Where(n => authors.Any(a => a == AccountDM.GetUserName(n.Author))).ToList();
            }
            if (!string.IsNullOrWhiteSpace(filter.LikedBy))
            {
                string[] likedBy = filter.LikedBy.Split(';');
                notes = notes.Where(n => likedBy.Any(a => NoteDM.IsLiked(AccountDM.GetUserId(a), n.Id))).ToList();
            }
            return(notes);
        }
Exemple #2
0
 public static void Add(NoteDM note)
 {
     Global.business.AddNote(Mapper.Map <Notebook.Common.Note>(note));
 }
Exemple #3
0
 public static void Add(NoteDM note)
 {
     Global.business.AddNote(Mapper.Map<Notebook.Common.Note>(note));
 }