31 lines
855 B
C#
31 lines
855 B
C#
|
|
using Core.Interfaces;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|
|||
|
|
namespace phronCare.API.Controllers.Sales
|
|||
|
|
{
|
|||
|
|
[Route("api/[controller]")]
|
|||
|
|
[ApiController]
|
|||
|
|
public class CustomerController : ControllerBase
|
|||
|
|
{
|
|||
|
|
private readonly ICustomerDom _customerService;
|
|||
|
|
public CustomerController(ICustomerDom customerService)
|
|||
|
|
{
|
|||
|
|
_customerService = customerService ?? throw new ArgumentNullException(nameof(customerService));
|
|||
|
|
}
|
|||
|
|
[HttpGet("GetAll")]
|
|||
|
|
public async Task<IActionResult> GetAll()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var result = await _customerService.GetAllAsync();
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return BadRequest(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|