Exemple #1
0
        public async Task <IHttpActionResult> GetAll()
        {
            var result = await _repository.GetAll <Client>();

            var response = new GetClientsResponse {
                Result = result
            };

            return(Ok(response));
        }
Exemple #2
0
        public GetClientsResponse GetClients()
        {
            GetClientsResponse getClientsResponse = new GetClientsResponse();

            try
            {
                getClientsResponse = _clientDataAccess.GetClients();
            }
            catch (Exception ex)
            {
                Console.WriteLine("ProductModel.GetClients : ERROR : " + ex.Message);
                throw;
            }
            return(getClientsResponse);
        }
Exemple #3
0
        public GetClientsResponse GetClients()
        {
            GetClientsResponse getClientsResponse = new GetClientsResponse();

            try
            {
                var query = from cl in context.ClientsEntity
                            select cl;
                getClientsResponse.ClientsEntities = query.ToList();
            }
            catch (Exception ex)
            {
                Console.WriteLine("ProductDataAccess.GetClients : ERROR : " + ex.Message);
                throw;
            }
            return(getClientsResponse);
        }
        public GetClientsResponse GetClients()
        {
            GetClientsResponse clientsResponse = new GetClientsResponse();

            try
            {
                MASFARMACIADEVContext context = new MASFARMACIADEVContext();
                var query = context.ClientsEntity.ToList();
                clientsResponse.ClientsEntities = query;
            }
            catch (Exception ex)
            {
                Console.WriteLine("ProductDataAccess.GetClients : ERROR : " + ex.Message);
                throw;
            }
            return(clientsResponse);
        }
        public GetClientsResponse ApiGetClients()
        {
            var getClientsResponse = new GetClientsResponse();

            try
            {
                getClientsResponse.Rows = this.ExecuteApiGetClients();
            }
            catch (Exception ex)
            {
                if (((HttpWebResponse)((WebException)ex.InnerException).Response).StatusCode == HttpStatusCode.Unauthorized)
                {
                    _apiAuthentication.GetToken(true);
                    getClientsResponse.Rows = this.ExecuteApiGetClients();
                }
            }

            return(getClientsResponse);
        }
        public async Task <IActionResult> GetAll([FromQuery] GetClientsRequest request)
        {
            try
            {
                var clients = await clientService.GetAllAsync();

                var response = new GetClientsResponse
                {
                    Items = mapper.Map <List <ClientDto> >(clients),
                    Total = clients.Count
                };

                return(Ok(response));
            }
            catch (Exception e)
            {
                return(ExceptionResult(e));
            }
        }