public async Task <ClipboardContainerGetData> GetLaneWithContext(Guid lane) { if (lane == Guid.Empty) { throw new ArgumentNullException(nameof(lane)); } using SqlConnection connection = this.authService.Connection; DatabaseContext context = new DatabaseContext(connection); List <ClipboardGetData> entries = await(from cc in context.ClipboardContent where cc.UserId == this.authService.UserId && cc.IsArchived == false && cc.LaneId == lane select ClipboardGetData.CreateFromEntity(cc, cc.FileToken)).ToListAsync(); List <LaneGetData> lanes = await LaneController.GetLanesForUser(context, this.authService.UserId); ClipboardContainerGetData result = new ClipboardContainerGetData() { Entries = entries, Lanes = lanes }; await connection.CloseAsync(); return(result); }
public async Task <ClipboardContainerGetData> GetWithContext(Guid?id = null) { using SqlConnection connection = this.authService.Connection; DatabaseContext context = new DatabaseContext(connection); List <ClipboardGetData> entries = await(from cc in context.ClipboardContent where cc.UserId == this.authService.UserId && cc.IsArchived == false && (cc.Id == id || id == null) select ClipboardGetData.CreateFromEntity(cc, cc.FileToken)).ToListAsync(); List <LaneGetData> lanes = await LaneController.GetLanesForUser(context, this.authService.UserId); ClipboardContainerGetData result = new ClipboardContainerGetData() { Entries = entries, Lanes = lanes }; await connection.CloseAsync(); return(result); }