Skip to content

Instantly share code, notes, and snippets.

@ducmeit1
Created July 15, 2019 08:16
Show Gist options
  • Save ducmeit1/c6c05c6e820cc3fc4367230c1c621d59 to your computer and use it in GitHub Desktop.
Save ducmeit1/c6c05c6e820cc3fc4367230c1c621d59 to your computer and use it in GitHub Desktop.
using System;
using System.Threading.Tasks;
using Customer.Domain.Commands;
using Customer.Domain.Dtos;
using Customer.Domain.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace Customer.API.Controllers
{
public class CustomerController : ApiControllerBase
{
public CustomerController(IMediator mediator) : base(mediator)
{
}
/// <summary>
/// Create new customer
/// </summary>
/// <param name="command">Info of customer</param>
/// <returns></returns>
[HttpPost]
[ProducesResponseType(200)]
[ProducesResponseType(400)]
public async Task<ActionResult> CreateCustomerAsync([FromBody] CreateCustomerCommand command)
{
return Ok(await CommandAsync(command));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment