目录
一、CuponesController : ControllerBase
二、CuponesController : ControllerBase
三、CuponesController : ControllerBase
四、CuponesController : ControllerBase
五、CuponesController : ControllerBase
一、CuponesController : ControllerBase
namespace API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CuponesController : ControllerBase
{
二、CuponesController : ControllerBase
private readonly CuponesManager _manager;
public CuponesController()
{
_manager = new CuponesManager();
}
三、CuponesController : ControllerBase
[HttpPost]
public ActionResult CreateCupon(Cupones cupon)
{
_manager.CreateCupon(cupon);
return Ok();
}
[HttpPost("apply")]
public ActionResult ApplyCupon(string codigo, string correoElectronico)
{
_manager.ApplyCupon(codigo, correoElectronico);
return Ok();
}
}
}
四、CuponesController : ControllerBase
namespace API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CuponesController : ControllerBase
{
private readonly CuponesManager _manager;
public CuponesController()
{
_manager = new CuponesManager();
}
[HttpPost]
public ActionResult CreateCupon(Cupones cupon)
{
_manager.CreateCupon(cupon);
return Ok();
}
五、CuponesController : ControllerBase
[HttpPost("apply")]
public ActionResult ApplyCupon(string codigo, string correoElectronico)
{
_manager.ApplyCupon(codigo, correoElectronico);
return Ok();
}
}
}