public ActionResult <DtoUserList> users(string search) { var au = GetCurrentAuthenticatedUser(); var repo = new DapperUserRepository(); var srv = new SrvUserListV1(repo); var dto = new DtoUserList(); if (!srv.Exec(network, au, search, ref dto)) { return(BadRequest(srv.Error)); } return(Ok(dto)); }
public bool Exec(LocalNetwork network, DtoAuthenticatedUser au, string pesquisa, ref DtoUserList dto) { try { using (var db = GetConnection(network)) { var lstClient = repository.GetUsers(db, "%" + pesquisa + "%"); dto.total = lstClient.Count; dto.results = lstClient; foreach (var item in dto.results) { // extra processing } } return(true); } catch (Exception ex) { Error = new DtoServiceError { message = getLanguage("0", 0), debugInfo = ex.ToString() }; return(false); } }