public class SalesOrderController : ApiController
{
private SalesOrderServiceProvider salesOrderServiceProvider;
public SalesOrderController()
{
this.salesOrderServiceProvider = new SalesOrderServiceProvider();
}
[HttpPost]
public SalesOrderCreatedApiResponse Post([FromBody] SalesOrderApiRequest request)
{
try
{
if (request != null)
{
return (this.salesOrderServiceProvider.createSalesOrder(request)) ? new SalesOrderCreatedApiResponse(true, "sales order created successfully") : new SalesOrderCreatedApiResponse(false, "Oops could not create sales order");
}
return new SalesOrderCreatedApiResponse(false, "invalid request body");
}catch(Exception ex)
{
return new SalesOrderCreatedApiResponse(false, ex.Message);
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.