public Task <IEnumerable <SectionWithLoginUser> > GetAsync(SectionWithLoginUserSearch option, CancellationToken token = default(CancellationToken)) { var query = @" SELECT sl.* , sc.Code SectionCode , sc.Name SectionName , lu.Code LoginUserCode , lu.Name LoginUserName FROM SectionWithLoginUser sl INNER JOIN Section sc ON sc.Id = sl.SectionId INNER JOIN LoginUser lu ON lu.Id = sl.LoginUserId WHERE sl.LoginUserId = sl.LoginUserId"; if (option.CompanyId.HasValue) { query += @" AND sc.CompanyId = @CompanyId"; } if (option.SectionId.HasValue) { query += @" AND sl.SectionId = @SectionId"; } if (option.LoginUserId.HasValue) { query += @" AND sl.LoginUserId = @LoginUserId"; } if (option.SectionCodes?.Any() ?? false) { query += @" AND sc.Code IN (SELECT Code FROM @SectionCodes)"; } query += @" ORDER BY sc.Code ASC , lu.Code ASC"; return(dbHelper.GetItemsAsync <SectionWithLoginUser>(query, new { option.CompanyId, option.SectionId, option.LoginUserId, SectionCodes = option.SectionCodes.GetTableParameter(), }, token)); }
public async Task <ActionResult <IEnumerable <SectionWithLoginUser> > > GetItems(SectionWithLoginUserSearch option, CancellationToken token) => (await sectionWithLoginUserProcessor.GetAsync(option, token)).ToArray();
public async Task <SectionWithLoginUsersResult> GetItemsAsync(string SessionKey, int CompanyId, SectionWithLoginUserSearch SectionWithLoginUserSearch) { return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token => { var result = (await sectionWithLoginUserProcessor.GetAsync(SectionWithLoginUserSearch, token)).ToList(); return new SectionWithLoginUsersResult { ProcessResult = new ProcessResult { Result = true }, SectionWithLoginUsers = result, }; }, logger)); }
public async Task <IEnumerable <SectionWithLoginUser> > GetAsync(SectionWithLoginUserSearch option, CancellationToken token = default(CancellationToken)) => await sectionWithLoginUserQueryProcessor.GetAsync(option, token);