37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: PartSource.Controllers.BaseNexpartController
|
|
// Assembly: PartSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 9C95A003-DAA7-4079-9F59-D1FC80E1666C
|
|
// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.dll
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using PartSource.Data.Nexpart;
|
|
using PartSource.Data.Nexpart.Interfaces;
|
|
|
|
namespace PartSource.Api.Controllers
|
|
{
|
|
public class BaseNexpartController : ControllerBase
|
|
{
|
|
protected ActionResult NexpartResponse<T, U>(T response) where T : IResponseElement<U>
|
|
{
|
|
Exceptions[] exceptions = response.PSResponseHeader.Exceptions;
|
|
if ((exceptions != null ? ((uint)exceptions.Length > 0U ? 1 : 0) : 0) == 0)
|
|
{
|
|
return Ok(new
|
|
{
|
|
Data = response.ResponseBody
|
|
});
|
|
}
|
|
|
|
string empty = string.Empty;
|
|
foreach (Exceptions exception in response.PSResponseHeader.Exceptions)
|
|
empty += string.Format("{0}\n", (object)exception.Value);
|
|
|
|
return BadRequest(new
|
|
{
|
|
Data = response.ResponseBody
|
|
});
|
|
}
|
|
}
|
|
}
|