using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using log4net; namespace AIAHTML5.API.Controllers { public class AuthenticateController : ApiController { // GET api/authenticate public IEnumerable Get() { return new string[] { "value1", "value2" }; } // GET api/authenticate/5 public string Get(int id) { return "value"; } // POST api/authenticate public HttpResponseMessage Post([FromBody]JObject credentials) { // log4net.Config.XmlConfigurator.Configure(); ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("inside POST"); dynamic userDetails = AIAHTML5.API.Models.Users.AuthenticateUser(credentials); //JsonSerializerSettings settings = new JsonSerializerSettings() //{ // ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, // DateFormatHandling = DateFormatHandling.IsoDateFormat, //}; return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(userDetails)) }; } // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { } // DELETE api/authenticate/5 public void Delete(int id) { } } }