/// <summary> /// Get next available BaseNoteOrdinal /// </summary> /// <param name="db">ApplicationDbContext</param> /// <param name="noteFileId">NoteFileID</param> /// <returns></returns> public static async Task <int> NextBaseNoteOrdinal(ApplicationDbContext 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); }