Created
January 16, 2021 08:09
-
-
Save sampetrosov/d29fd9c18078db3ffedcf944bb07b636 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json.Linq; | |
using PX.Data; | |
using PX.Export.Authentication; | |
using System.Web.Http; | |
using CustomController.Models; | |
using CustomController.Helpers; | |
using System.Web; | |
namespace CustomController | |
{ | |
[RoutePrefix("api/v1/IIG")] | |
[BasicAuthorize] | |
public partial class IIGController : ApiController | |
{ | |
[HttpPost] | |
[Route("PostData")] | |
public IHttpActionResult PostData([FromBody]JObject data) | |
{ | |
var lead = data.ToObject<BusAccount>(); | |
if (lead == null) | |
return BadRequest("Passed object structure is not corresponding to the requirements"); | |
var retVal = BusAccount.CreateBusAccount(lead); | |
if (retVal) | |
return Ok(); | |
else | |
return BadRequest("Error has been thrown while processing the data"); | |
} | |
protected override void Dispose(bool disposing) | |
{ | |
if (HttpContext.Current != null && HttpContext.Current.Session != null) | |
{ | |
PXLogin.LogoutUser(PXAccess.GetUserName(), HttpContext.Current.Session.SessionID); | |
} | |
FormsAuthenticationModule.SignOut(); | |
base.Dispose(disposing); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment