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.
61 lines
2.0 KiB
61 lines
2.0 KiB
using Business.Mobile;
|
|
using Common;
|
|
using Common.Model;
|
|
using log4net;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
|
|
namespace JsonRx.ApiV3
|
|
{
|
|
/// <summary>
|
|
/// This controller endpoints should be used to perform realtime data validation
|
|
/// </summary>
|
|
[RoutePrefix("api/v3")]
|
|
public class ValidationController : ApiController
|
|
{
|
|
private readonly IMobileServices _obj;
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ValidationController));
|
|
|
|
/// <summary>
|
|
/// constructor
|
|
/// </summary>
|
|
public ValidationController() { }
|
|
|
|
/// <summary>
|
|
/// Constructor that injects IMobileServices service
|
|
/// </summary>
|
|
/// <param name="requestServices"></param>
|
|
public ValidationController(IMobileServices requestServices)
|
|
{
|
|
_obj = requestServices;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Endpoint to validate data
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("validation")]
|
|
public IHttpActionResult RealtimeValidation(RealtimeValidationModel model)
|
|
{
|
|
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
|
|
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = "Anonymous";
|
|
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = nameof(ValidationController.RealtimeValidation);
|
|
|
|
System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers;
|
|
|
|
string lang = headers.GetValues("lang").FirstOrDefault();
|
|
Log.DebugFormat("New user Register | Lang {0}| REQUEST {1}", lang, JsonConvert.SerializeObject(model));
|
|
|
|
var resp = _obj.RealtimeValidation(model, lang);
|
|
|
|
Log.Debug("RealtimeValidation | Result:" + JsonConvert.SerializeObject(resp));
|
|
return Ok(resp);
|
|
}
|
|
}
|
|
}
|