-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCustomersController.cs
46 lines (38 loc) · 1.08 KB
/
CustomersController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Business.Abstract;
using Entities.Concrete;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace WebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CustomersController : ControllerBase
{
private readonly ICustomerService _customerService;
public CustomersController(ICustomerService customerService)
{
_customerService = customerService;
}
[HttpGet("getallcustomers")]
public IActionResult GetAllCustomers()
{
var result = _customerService.GetAll();
if (result.Success)
{
return Ok(result);
}
return BadRequest(result);
}
[HttpPost("add")]
public IActionResult Add(Customer customer)
{
var result = _customerService.Add(customer);
if (result.Success)
{
return Ok(result);
}
return BadRequest(result);
}
//TODO : Update,Delete and other Endpoints
}
}