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