예제 #1
0
        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));
        }
예제 #2
0
        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);
            }
        }