public async Task <NoteDisplayIndexModel> Get(string sid) { NoteDisplayIndexModel idxModel = new NoteDisplayIndexModel(); if (!sid.Contains(".")) { idxModel.message = "string passed to server must be in form fileId.ArciveID"; return(idxModel); } string[] stuff = sid.Split("."); int id = int.Parse(stuff[0]); int arcId = int.Parse(stuff[1]); bool isAdmin = User.IsInRole("Admin"); idxModel.linkedText = string.Empty; idxModel.myAccess = await GetMyAccess(id, arcId); if (isAdmin) { idxModel.myAccess.ViewAccess = true; } idxModel.noteFile = await NoteDataManager.GetFileById(_db, id); if (!idxModel.myAccess.ReadAccess && !idxModel.myAccess.Write) { idxModel.message = "You do not have access to file " + idxModel.noteFile.NoteFileName; return(idxModel); } List <LinkedFile> linklist = await _db.LinkedFile.Where(p => p.HomeFileId == id).ToListAsync(); if (linklist != null && linklist.Count > 0) { idxModel.linkedText = " (Linked)"; } idxModel.AllNotes = await NoteDataManager.GetAllHeaders(_db, id, arcId); // Extract the Base Notes Objects on the client side from AllNotes //idxModel.ExpandOrdinal = 0; string myname = User.Identity.Name; var IdUser = await _userManager.FindByEmailAsync(myname); string uid = await _userManager.GetUserIdAsync(IdUser); idxModel.UserData = LocalManager.GetUserData(uid, _db); idxModel.tZone = await LocalManager.GetUserTimeZone(uid, _db); List <Mark> marks = await _db.Mark.Where(p => p.UserId == uid).ToListAsync(); idxModel.isMarked = (marks != null && marks.Count > 0); if (idxModel.isMarked) { idxModel.isMarked = marks.Where(p => p.NoteFileId == id && p.ArchiveId == arcId).Any(); } //idxModel.rPath = Request.PathBase; idxModel.ArcId = arcId; return(idxModel); }