Esempio n. 1
0
        public static async Task <bool> TestLinkAccess(NotesDbContext NotesDbContext,
                                                       NoteFile noteFile, string secret)
        {
            try
            {
                List <LinkedFile> linkedFiles;

                if (string.IsNullOrEmpty(secret))
                {
                    linkedFiles = await NotesDbContext.LinkedFile
                                  .Where(p => p.RemoteFileName == noteFile.NoteFileName && p.AcceptFrom)
                                  .ToListAsync();
                }
                else
                {
                    linkedFiles = await NotesDbContext.LinkedFile
                                  .Where(p => p.RemoteFileName == noteFile.NoteFileName && p.AcceptFrom && p.Secret == secret)
                                  .ToListAsync();
                }
                if (linkedFiles == null || linkedFiles.Count < 1)
                {
                    return(false);
                }

                return(true);
            }
            catch { return(false); }
        }
Esempio n. 2
0
 public static async Task <List <NoteHeader> > GetSeqHeader2(NotesDbContext db, Sequencer myseqfile)
 {
     return(await db.NoteHeader
            .Where(x => x.NoteFileId == myseqfile.NoteFileId && x.ArchiveId == 0 && x.LastEdited >= myseqfile.LastTime && x.ResponseOrdinal == 0)
            .OrderBy(x => x.NoteOrdinal)
            .ToListAsync());
 }
Esempio n. 3
0
        public static void ArchiveNoteFile(NotesDbContext _db, NoteFile noteFile)
        {
            noteFile.NumberArchives++;
            _db.Update(noteFile);

            List <NoteHeader> nhl = _db.NoteHeader.Where(p => p.NoteFileId == noteFile.Id && p.ArchiveId == 0).ToList();

            foreach (NoteHeader nh in nhl)
            {
                nh.ArchiveId = noteFile.NumberArchives;
                _db.Update(nh);
            }

            List <NoteAccess> nal = _db.NoteAccess.Where(p => p.NoteFileId == noteFile.Id && p.ArchiveId == 0).ToList();

            foreach (NoteAccess na in nal)
            {
                na.ArchiveId = noteFile.NumberArchives;
            }
            _db.NoteAccess.AddRange(nal);

            List <Tags> ntl = _db.Tags.Where(p => p.NoteFileId == noteFile.Id && p.ArchiveId == 0).ToList();

            foreach (Tags nt in ntl)
            {
                nt.ArchiveId = noteFile.NumberArchives;
                _db.Update(nt);
            }

            _db.SaveChanges();
        }
Esempio n. 4
0
        /// <summary>
        /// Get Users Specific Access Entry
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="userId">ID of logged in user</param>
        /// <param name="fileId">NoteFileID</param>
        /// <returns>NoteAcess Object</returns>
        public static async Task <NoteAccess> GetOneAccess(NotesDbContext db, string userId, int fileId, int arcId)
        {
            NoteAccess na = await db.NoteAccess
                            .Where(p => p.UserID == userId && p.NoteFileId == fileId && p.ArchiveId == arcId).FirstOrDefaultAsync();

            return(na);
        }
Esempio n. 5
0
        /// <summary>
        /// Create a NoteFile
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="userManager">UserManager</param>
        /// <param name="userId">UserID of creator</param>
        /// <param name="name">NoteFile name</param>
        /// <param name="title">NoteFile title</param>
        /// <returns></returns>
        public static async Task <bool> CreateNoteFile(NotesDbContext db,
                                                       UserManager <IdentityUser> userManager,
                                                       string userId, string name, string title)
        {
            var query = db.NoteFile.Where(p => p.NoteFileName == name);

            if (!query.Any())
            {
                NoteFile noteFile = new NoteFile()
                {
                    NoteFileName  = name,
                    NoteFileTitle = title,
                    Id            = 0,
                    OwnerId       = userId,
                    LastEdited    = DateTime.Now.ToUniversalTime()
                };
                db.NoteFile.Add(noteFile);
                await db.SaveChangesAsync();

                NoteFile nf = await db.NoteFile
                              .Where(p => p.NoteFileName == noteFile.NoteFileName)
                              .FirstOrDefaultAsync();

                await AccessManager.CreateBaseEntries(db, userManager, userId, nf.Id);

                return(true);
            }
            return(false);
        }
Esempio n. 6
0
 /// <summary>
 /// Get all the BaseNoteHeaders for a file
 /// </summary>
 /// <param name="db">NotesDbContext</param>
 /// <param name="nfid">fileid</param>
 /// <returns></returns>
 public static async Task <List <NoteHeader> > GetBaseNoteHeadersForFile(NotesDbContext db, int nfid, int arcId)
 {
     return(await db.NoteHeader
            .Where(p => p.NoteFileId == nfid && p.ArchiveId == arcId && p.ResponseOrdinal == 0)
            .OrderBy(p => p.NoteOrdinal)
            .ToListAsync());
 }
Esempio n. 7
0
        public static async Task <string> DeleteLinked(NotesDbContext db, NoteHeader nh)
        {
            // Check for linked notefile(s)

            List <LinkedFile> links = await db.LinkedFile.Where(p => p.HomeFileId == nh.NoteFileId).ToListAsync();

            if (links == null || links.Count < 1)
            {
            }
            else
            {
                foreach (var link in links)
                {
                    if (link.SendTo)
                    {
                        LinkQueue q = new LinkQueue
                        {
                            Activity     = LinkAction.Delete,
                            LinkGuid     = nh.LinkGuid,
                            LinkedFileId = nh.NoteFileId,
                            BaseUri      = link.RemoteBaseUri,
                            Secret       = link.Secret
                        };

                        db.LinkQueue.Add(q);
                        await db.SaveChangesAsync();
                    }
                }
            }

            return("Ok");
        }
Esempio n. 8
0
 public static async Task <NoteFile> GetFileByIdWithOwner(NotesDbContext db, int id)
 {
     return(await db.NoteFile
            .Include(a => a.Owner)
            .Where(p => p.Id == id)
            .FirstOrDefaultAsync());
 }
Esempio n. 9
0
 public static async Task <List <Sequencer> > GetSeqListForUser(NotesDbContext db, string userid)
 {
     return(await db.Sequencer
            .Where(x => x.UserId == userid)
            .OrderBy(x => x.Ordinal)
            .ToListAsync());
 }
Esempio n. 10
0
        /// <summary>
        /// Given a NoteContent Object and Response number get the response NoteID
        /// </summary>
        /// <param name="db"></param>
        /// <param name="nc"></param>
        /// <param name="resp"></param>
        /// <returns></returns>
        public static async Task <long?> FindResponseId(NotesDbContext db, NoteHeader nc, int resp)
        {
            NoteHeader content = await db.NoteHeader
                                 .Where(p => p.NoteFileId == nc.NoteFileId && p.ArchiveId == nc.ArchiveId && p.NoteOrdinal == nc.NoteOrdinal && p.ResponseOrdinal == resp)
                                 .FirstOrDefaultAsync();

            return(content?.Id);
        }
Esempio n. 11
0
        // ReSharper disable once UnusedMember.Global
        public static async Task <long> GetNumberOfBaseNotes(NotesDbContext db, int fileid, int arcId)
        {
            List <NoteHeader> notes = await db.NoteHeader
                                      .Where(p => p.Id == fileid && p.ArchiveId == arcId && p.ResponseOrdinal == 0)
                                      .ToListAsync();

            return(notes.Count);
        }
Esempio n. 12
0
 public static async Task <NoteHeader> GetNoteById(NotesDbContext db, long noteid)
 {
     return(await db.NoteHeader
            .Include("NoteContent")
            .Include("Tags")
            .Where(p => p.Id == noteid)
            .FirstOrDefaultAsync());
 }
Esempio n. 13
0
 public static async Task <NoteHeader> GetMarkedNote(NotesDbContext db, Mark mark)
 {
     return(await db.NoteHeader
            .Include(m => m.NoteContent)
            .Include(m => m.Tags)
            .Where(p => p.NoteFileId == mark.NoteFileId && p.ArchiveId == mark.ArchiveId && p.NoteOrdinal == mark.NoteOrdinal && p.ResponseOrdinal == mark.ResponseOrdinal)
            .FirstAsync());
 }
Esempio n. 14
0
 public static async Task <List <NoteHeader> > GetBaseNoteAndResponses(NotesDbContext db, int nfid, int arcId, int noteord)
 {
     return(await db.NoteHeader
            .Include("NoteContent")
            .Include("Tags")
            .Where(p => p.NoteFileId == nfid && p.ArchiveId == arcId && p.NoteOrdinal == noteord)
            .ToListAsync());
 }
Esempio n. 15
0
        /// <summary>
        /// Delete a NoteFile
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="id">NoteFileID</param>
        /// <returns></returns>
        public static async Task <bool> DeleteNoteFile(NotesDbContext db, int id)
        {
            // Things to delete:
            // 1)  X Entries in NoteContent
            // 2)  X Entries in BaseNoteHeader
            // 3)  X Entries in Sequencer
            // 4)  X Entries in NoteAccesses
            // 5)  X Entries in Marks
            // 6)  X Entries in SearchView
            // 7)  1 Entry in NoteFile

            // The above (1 - 6) now done by Cascade Delete of NoteFile

            //List<NoteContent> nc = await _db.NoteContent
            //    .Where(p => p.NoteFileID == id)
            //    .ToListAsync();
            //List<BaseNoteHeader> bnh = await GetBaseNoteHeadersForFile(_db, id);
            //List<Sequencer> seq = await _db.Sequencer
            //.Where(p => p.NoteFileID == id)
            //.ToListAsync();
            //List<NoteAccess> na = await AccessManager.GetAccessListForFile(_db, id);
            //List<Mark> marks = await _db.Mark
            //    .Where(p => p.NoteFileID == id)
            //    .ToListAsync();
            //List<SearchView> sv = await _db.SearchView
            //    .Where(p => p.NoteFileID == id)
            //    .ToListAsync();

            //_db.NoteContent.RemoveRange(nc);
            //_db.BaseNoteHeader.RemoveRange(bnh);
            //_db.Sequencer.RemoveRange(seq);
            //_db.NoteAccess.RemoveRange(na);
            //_db.Mark.RemoveRange(marks);
            //_db.SearchView.RemoveRange(sv);

            NoteFile noteFile = await db.NoteFile
                                .Where(p => p.Id == id)
                                .FirstAsync();

            for (int arcId = 0; arcId <= noteFile.NumberArchives; arcId++)
            {
                List <NoteAccess> na = await AccessManager.GetAccessListForFile(db, id, arcId);

                db.NoteAccess.RemoveRange(na);
            }

            List <Subscription> subs = await db.Subscription
                                       .Where(p => p.NoteFileId == id)
                                       .ToListAsync();

            db.Subscription.RemoveRange(subs);

            db.NoteFile.Remove(noteFile);

            await db.SaveChangesAsync();

            return(true);
        }
Esempio n. 16
0
 public static async Task <List <NoteHeader> > GetOrderedListOfResponses(NotesDbContext db, int nfid, NoteHeader bnh)
 {
     return(await db.NoteHeader
            .Include(m => m.NoteContent)
            .Include(m => m.Tags)
            .Where(p => p.NoteFileId == nfid && p.ArchiveId == bnh.ArchiveId && p.NoteOrdinal == bnh.NoteOrdinal && p.ResponseOrdinal > 0)
            .OrderBy(p => p.ResponseOrdinal)
            .ToListAsync());
 }
Esempio n. 17
0
        public static async Task <NoteFile> GetFileByIdWithHeaders(NotesDbContext db, int id, int arcId)
        {
            NoteFile nf = await db.NoteFile
                          .Where(p => p.Id == id)
                          .FirstOrDefaultAsync();

            //nf.NoteHeaders = await db.NoteHeader.Where(p => p.NoteFileId == id && p.ArchiveId == arcId).ToListAsync();

            return(nf);
        }
Esempio n. 18
0
        public static async Task <NoteHeader> GetBaseNoteHeader(NotesDbContext db, long id)
        {
            NoteHeader nh = await db.NoteHeader
                            .Where(p => p.Id == id)
                            .FirstOrDefaultAsync();

            return(await db.NoteHeader
                   .Where(p => p.Id == nh.BaseNoteId)
                   .FirstOrDefaultAsync());
        }
Esempio n. 19
0
 public static async Task <NoteHeader> GetNoteByIdWithFile(NotesDbContext db, long noteid)
 {
     return(await db.NoteHeader
            .Include("NoteContent")
            .Include("NoteFile")
            .Include("Tags")
            .Where(p => p.Id == noteid)
            .OrderBy((x => x.NoteOrdinal))
            .FirstOrDefaultAsync());
 }
Esempio n. 20
0
 /// <summary>
 /// Delete a Note
 /// </summary>
 /// <param name="db">NotesDbContext</param>
 /// <param name="nc">NoteContent</param>
 /// <returns></returns>
 public static async Task <bool> DeleteNote(NotesDbContext db, NoteHeader nc)
 {
     if (nc.ResponseOrdinal == 0)     // base note
     {
         return(await DeleteBaseNote(db, nc));
     }
     else  // Response
     {
         return(await DeleteResponse(db, nc));
     }
 }
Esempio n. 21
0
        /// <summary>
        /// Get next available BaseNoteOrdinal
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="noteFileId">NoteFileID</param>
        /// <returns></returns>
        public static async Task <int> NextBaseNoteOrdinal(NotesDbContext db, int noteFileId, int arcId)
        {
            IOrderedQueryable <NoteHeader> bnhq = GetBaseNoteHeaderByIdRev(db, noteFileId, arcId);

            if (bnhq == null || !bnhq.Any())
            {
                return(1);
            }

            NoteHeader bnh = await bnhq.FirstAsync();

            return(bnh.NoteOrdinal + 1);
        }
Esempio n. 22
0
        //TODO
        //public static async Task<bool> SendNotesAsync(ForwardViewModel fv, NotesDbContext db, IEmailSender emailSender,
        //        string email, string name, string Url)
        //{
        //    await emailSender.SendEmailAsync(fv.ToEmail, fv.NoteSubject,
        //        await MakeNoteForEmail(fv, db, email, name, Url));

        //    return true;
        //}


        private static async Task <string> MakeNoteForEmail(ForwardViewModel fv, NotesDbContext db, string email, string name, string ProductionUrl)
        {
            NoteHeader nc = await GetNoteByIdWithFile(db, fv.NoteID);

            if (!fv.hasstring || !fv.wholestring)
            {
                return("Forwarded by Notes 2021 - User: "******" / " + name
                       + "<p>File: " + nc.NoteFile.NoteFileName + " - File Title: " + nc.NoteFile.NoteFileTitle + "</p><hr/>"
                       + "<p>Author: " + nc.AuthorName + "  - Director Message: " + nc.NoteContent.DirectorMessage + "</p><p>"
                       + "<p>Subject: " + nc.NoteSubject + "</p>"
                       + nc.LastEdited.ToShortDateString() + " " + nc.LastEdited.ToShortTimeString() + " UTC" + "</p>"
                       + nc.NoteContent.NoteBody
                       + "<hr/>" + "<a href=\"" + ProductionUrl + "NoteDisplay/Display/" + fv.NoteID + "\" >Link to note</a>");
            }
            else
            {
                List <NoteHeader> bnhl = await GetBaseNoteHeadersForNote(db, nc.NoteFileId, nc.ArchiveId, nc.NoteOrdinal);

                NoteHeader bnh = bnhl[0];
                fv.NoteSubject = bnh.NoteSubject;
                List <NoteHeader> notes = await GetBaseNoteAndResponses(db, nc.NoteFileId, nc.ArchiveId, nc.NoteOrdinal);

                StringBuilder sb = new StringBuilder();
                sb.Append("Forwarded by Notes 2020 - User: "******" / " + name
                          + "<p>\nFile: " + nc.NoteFile.NoteFileName + " - File Title: " + nc.NoteFile.NoteFileTitle + "</p>"
                          + "<hr/>");

                for (int i = 0; i < notes.Count; i++)
                {
                    if (i == 0)
                    {
                        sb.Append("<p>Base Note - " + (notes.Count - 1) + " Response(s)</p>");
                    }
                    else
                    {
                        sb.Append("<hr/><p>Response - " + notes[i].ResponseOrdinal + " of " + (notes.Count - 1) + "</p>");
                    }
                    sb.Append("<p>Author: " + notes[i].AuthorName + "  - Director Message: " + notes[i].NoteContent.DirectorMessage + "</p>");
                    sb.Append("<p>Subject: " + notes[i].NoteSubject + "</p>");
                    sb.Append("<p>" + notes[i].LastEdited.ToShortDateString() + " " + notes[i].LastEdited.ToShortTimeString() + " UTC" + " </p>");
                    sb.Append(notes[i].NoteContent.NoteBody);
                    sb.Append("<hr/>");
                    sb.Append("<a href=\"");
                    sb.Append(ProductionUrl + "NoteDisplay/Display/" + notes[i].Id + "\" >Link to note</a>");
                }

                return(sb.ToString());
            }
        }
Esempio n. 23
0
        /// <summary>
        /// All access checks call this
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="userId">ID of logged in user</param>
        /// <param name="fileId">NoteFileID</param>
        /// <returns>NoteAcess Object</returns>
        public static async Task <NoteAccess> GetAccess(NotesDbContext db, string userId, int fileId, int arcId)
        {
            // Next we check for this user specifically
            NoteAccess na = await db.NoteAccess
                            .Where(p => p.UserID == userId && p.NoteFileId == fileId && p.ArchiveId == arcId).FirstOrDefaultAsync();

            if (na != null)
            {
                return(na);
            }

            // If specific user not in list use "Other"
            return(await db.NoteAccess
                   .Where(p => p.UserID == "Other" && p.NoteFileId == fileId && p.ArchiveId == arcId).FirstOrDefaultAsync());
        }
Esempio n. 24
0
        /// <summary>
        /// Create standard starting entires for a access controls for a new file.
        /// "Other" -- no access
        /// creating user (Admin) -- Full Access
        /// [email protected] if it exists -- no access
        /// </summary>
        /// <param name="db"></param>
        /// <param name="userManager"></param>
        /// <param name="userId"></param>
        /// <param name="fileId"></param>
        /// <returns></returns>
        public static async Task <bool> CreateBaseEntries(NotesDbContext db, UserManager <IdentityUser> userManager, string userId, int fileId)
        {
            if (true)
            {
                bool flag1 = await Create(db, "Other", fileId, false, false, false, false, false, false, false);

                if (!flag1)
                {
                    return(false);
                }
            }

            if (true)
            {
                bool flag1 = await Create(db, userId, fileId, true, true, true, true, true, true, true);

                if (!flag1)
                {
                    return(false);
                }
            }

            try
            {
                var user = await userManager.FindByNameAsync("*****@*****.**");

                if (user == null)
                {
                    return(true);
                }

                string readonlyId = user.Id;

                {
                    bool flag1 = await Create(db, readonlyId, fileId, false, false, false, false, false, false, false);

                    if (!flag1)
                    {
                        return(false);
                    }
                }
            }
            catch
            {
                // ignored
            }
            return(true);
        }
Esempio n. 25
0
        /// <summary>
        /// Delete a Response Note
        /// </summary>
        /// <param name="db">NotesDbContext</param>
        /// <param name="nc">NoteContent</param>
        /// <returns></returns>
        // Steps involved:
        // 1. Delete single NoteContent row where NoteFileID, NoteOrdinal, and ResponseOrdinal match input
        // 2. Decrement all NoteContent.ResponseOrdinal where NoteFileID, and NoteOrdinal match input and NoteContent.ResponseOrdinal > nc.ResponseOrdinal
        // 3. Decrement single row (Responses field)in BaseNoteHeader where NoteFileID, NoteOrdinal match input
        private static async Task <bool> DeleteResponse(NotesDbContext db, NoteHeader nc)
        {
            int fileId  = nc.NoteFileId;
            int arcId   = nc.ArchiveId;
            int noteOrd = nc.NoteOrdinal;
            int respOrd = nc.ResponseOrdinal;

            try
            {
                List <NoteHeader> deleteCont = await db.NoteHeader
                                               .Where(p => p.NoteFileId == fileId && p.ArchiveId == arcId && p.NoteOrdinal == noteOrd && p.ResponseOrdinal == nc.ResponseOrdinal)
                                               .ToListAsync();

                if (deleteCont.Count != 1)
                {
                    return(false);
                }

                await DeleteLinked(db, deleteCont.First());

                db.NoteHeader.Remove(deleteCont.First());

                List <NoteHeader> upCont = await db.NoteHeader
                                           .Where(p => p.NoteFileId == fileId && p.ArchiveId == arcId && p.NoteOrdinal == noteOrd && p.ResponseOrdinal > respOrd)
                                           .ToListAsync();

                foreach (var cont in upCont)
                {
                    cont.ResponseOrdinal--;
                    db.Entry(cont).State = EntityState.Modified;
                }

                NoteHeader bnh = await GetBaseNoteHeader(db, fileId, arcId, noteOrd);

                bnh.ResponseCount--;
                db.Entry(bnh).State = EntityState.Modified;

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                // ignored
            }

            return(false);
        }
Esempio n. 26
0
        public static async Task <NoteHeader> CreateResponse(NotesDbContext db, UserManager <IdentityUser> userManager, NoteHeader nh, string body, string tags, string dMessage, bool send, bool linked)
        {
            NoteHeader mine = await GetBaseNoteHeader(db, nh.BaseNoteId);

            db.Entry(mine).State = EntityState.Unchanged;
            await db.SaveChangesAsync();

            mine.ThreadLastEdited = DateTime.Now.ToUniversalTime();
            mine.ResponseCount++;

            db.Entry(mine).State = EntityState.Modified;
            await db.SaveChangesAsync();

            nh.ResponseOrdinal = mine.ResponseCount;
            nh.NoteOrdinal     = mine.NoteOrdinal;
            return(await CreateNote(db, userManager, nh, body, tags, dMessage, send, linked));
        }
Esempio n. 27
0
        public static async Task <bool> Audit(NotesDbContext db, string eventType, string userName, string userId,
                                              string Event /*, TelemetryClient telemetry*/)
        {
            Audit na = new Audit();

            var usr = await db.Users.SingleAsync(p => p.UserName == userName);

            na.UserID    = usr.Id;
            na.UserName  = userName;
            na.EventType = eventType;
            na.Event     = Event;
            na.EventTime = System.DateTime.Now.ToUniversalTime();

            //telemetry.TrackEvent("Audit - " + userName + " - " + eventType + " - " + Event);

            db.Audit.Add(na);
            return((await db.SaveChangesAsync()) == 1);
        }
Esempio n. 28
0
        private static async Task <bool> Create(NotesDbContext db, string userId, int noteFileId, bool read, bool respond,
                                                bool write, bool setTag, bool deleteEdit, bool director, bool editAccess)
        {
            NoteAccess na = new NoteAccess()
            {
                UserID     = userId,
                NoteFileId = noteFileId,

                ReadAccess = read,
                Respond    = respond,
                Write      = write,
                SetTag     = setTag,
                DeleteEdit = deleteEdit,
                ViewAccess = director,
                EditAccess = editAccess
            };

            db.NoteAccess.Add(na);
            return((await db.SaveChangesAsync()) == 1);
        }
Esempio n. 29
0
        public static async Task <NoteContent> GetNoteContent(NotesDbContext db, int nfid, int ArcId, int noteord, int respOrd)
        {
            var header = await db.NoteHeader
                         .Where(p => p.NoteFileId == nfid && p.ArchiveId == ArcId && p.NoteOrdinal == noteord && p.ResponseOrdinal == respOrd)
                         .FirstAsync();

            if (header == null)
            {
                return(null);
            }

            var content = await db.NoteContent
                          .OfType <NoteContent>()
                          .Where(p => p.NoteHeaderId == header.Id)
                          .FirstAsync();

            content.NoteHeader = null;

            return(content);
        }
Esempio n. 30
0
 public static async Task <List <NoteHeader> > GetSearchHeaders(NotesDbContext db, Search start, NoteHeader bnh, SearchOption so)
 {
     if (so == SearchOption.Tag)
     {
         return(await db.NoteHeader
                .Include("Tags")
                .Where(x => x.NoteFileId == start.NoteFileId && x.ArchiveId == start.ArchiveId && x.NoteOrdinal > bnh.NoteOrdinal)
                .ToListAsync());
     }
     if (so == SearchOption.Content || so == SearchOption.DirMess)
     {
         return(await db.NoteHeader
                .Include("NoteContent")
                .Where(x => x.NoteFileId == start.NoteFileId && x.ArchiveId == start.ArchiveId && x.NoteOrdinal > bnh.NoteOrdinal)
                .ToListAsync());
     }
     return(await db.NoteHeader
            .Where(x => x.NoteFileId == start.NoteFileId && x.ArchiveId == start.ArchiveId && x.NoteOrdinal > bnh.NoteOrdinal)
            .ToListAsync());
 }