Professional Documents
Culture Documents
CSharp
CSharp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Application.Commands;
using Application.DataTransfer;
using Application.Exceptions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Northwind.API.Controllers
{
[Produces("application/json")]
{
return "value";
}
// POST: api/Orders
[HttpPost]
public IActionResult Post([FromBody] CreateOrderDto dto)
{
try
{
_createOrder.Execute(dto);
return Ok();
}
catch (EntityNotFoundException e)
{
throw new EntityNotFoundException("nema");
}
catch (Exception)
{
return StatusCode(500);
}
}
// PUT: api/Orders/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
}
}
}