48 lines
1.6 KiB
C#
48 lines
1.6 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 PartSource.Entities.Nexpart;
|
|
using PartSource.Entities.Nexpart.Interfaces;
|
|
using System;
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
|
|
namespace PartSource.Controllers
|
|
{
|
|
public class BaseNexpartController : ApiController
|
|
{
|
|
public IHttpActionResult NexpartResponse<T, U>(T response) where T : IResponseElement<U>
|
|
{
|
|
try
|
|
{
|
|
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 (IHttpActionResult)this.Content(HttpStatusCode.BadRequest, new
|
|
{
|
|
Data = response.ResponseBody
|
|
});
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
return (IHttpActionResult)this.Content(HttpStatusCode.InternalServerError, new
|
|
{
|
|
Message = ex.Message
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|