Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 static Global()
 {
     business = new Business(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
     filter = new NoteFilter();
 }
Ejemplo n.º 3
0
 public static List<DisplayNoteVM> DisplayAll(NoteFilter filter)
 {
     return Mapper.Map<List<DisplayNoteVM>>(GetAll(filter));
 }