예제 #1
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var data = await _customerQueries.GetCustomers();

                return(Ok(new ApiOkResponse(data, data.Count())));
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Error on Get Customers");
                return(BadRequest(new ApiBadRequestResponse(500, "Something Wrong")));
            }
        }
예제 #2
0
        public async Task <IActionResult> GetCustomers()
        {
            try
            {
                var customers = await _queries.GetCustomers();

                var response = _mapper.Map <List <CustomerViewModel> >(customers);
                return(Ok(response));
            }
            catch (Exception ex)
            {
                _logger.LogCritical("Exception trown: {ex}", ex.ToString());
                return(BadRequest(ex.Message));
            }
        }
예제 #3
0
        public async Task <IActionResult> Get(/*string username, string password*/)
        {
            try
            {
                // Test GRPC
                //var loginRequest = new LoginRequest
                //{
                //    UserName = username,
                //    Password = password
                //};
                //var result = await _login.LoginSystemAsync(loginRequest);

                var data = await _customerQueries.GetCustomers();

                return(Ok(new ApiOkResponse(data, data.Count())));
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Error on Get Customers");
                return(BadRequest(new ApiBadRequestResponse(500, "Something Wrong")));
            }
        }