You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
using System;
|
|
using System.Net.Mime;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Serialization;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
using Volo.Abp;
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
|
|
{
|
|
[Authorize]
|
|
[Route(RouteConsts.Part)]
|
|
|
|
public class PartController : ControllerBase
|
|
{
|
|
private readonly IHttpClientInvoker<PartCreateDto, PartDTO> _httpClientInvoker;
|
|
|
|
public PartController(IHttpClientInvoker<PartCreateDto,PartDTO> httpClientInvoker)
|
|
{
|
|
_httpClientInvoker = httpClientInvoker;
|
|
}
|
|
/// <summary>
|
|
/// 新增零件(Add part)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("")]
|
|
[Consumes(MediaTypeNames.Application.Xml)]
|
|
[Produces(MediaTypeNames.Application.Xml)]
|
|
public virtual async Task<ActionResult<PartDTO>> CreateAsync([FromBody]PartCreateDto input)
|
|
{
|
|
|
|
try
|
|
{
|
|
var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Part);
|
|
return Ok(dto);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return BadRequest(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|