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"))); } }
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)); } }
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"))); } }