public IActionResult GetCustomers() { try { return(Ok(_customersLogic.GetAll())); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult <List <CustomerDto> > Get() { try { IList <CustomerModel> result = _customerLogic.GetAll(); if (result.Any()) { return(Ok(_mapper.MapCollection <CustomerModel, CustomerDto>(result))); } return(NoContent()); } catch (Exception) { return(BadRequest()); } }
public async Task <IActionResult> GetCustomers() { var location = GetControllerActionNames(); try { _logger.LogInfo($"{location}: Attempted Call"); var customers = await _businessLogic.GetAll(); var response = _mapper.Map <IList <CustomerDTO> >(customers); _logger.LogInfo($"{location}: Successful"); return(Ok(response)); } catch (Exception e) { return(InternalError($"{location}: {e.Message} - {e.InnerException}")); } }
public IEnumerable <Customer> Get() { return(_customerLogic.GetAll()); }