using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using AIAHTML5.Server.Models; using System.Web.Http.Cors; using System.Web.Cors; using AIAHTML5.Server.Constants; using log4net; namespace AIAHTML5.Server.Controllers { [EnableCors(origins: "http://localhost:85", headers: "*", methods: "*")] public class UpdateProfileController : ApiController { DbModel objDbModel = new DbModel(); // GET: api/UpdateProfile public IEnumerable Get() { return new string[] { "value1", "value2" }; } // GET: api/UpdateProfile/5 public HttpResponseMessage Get(int id) { //return "value"; return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("SUCCESS") }; } //POST: api/UpdateProfile [EnableCors(origins: "http://localhost:85", headers: "*", methods: "*")] public string Post([FromBody]JObject userInfo) //int userId, string fName, string lName, string email { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); int userId = Convert.ToInt32(userInfo["userId"]); string fName = userInfo["firstName"].ToString(); string lName = userInfo["lastName"].ToString(); string email = userInfo["emailId"].ToString(); int result = objDbModel.UpdateUserProfile(userId, email, fName, lName); //, 0 if (result > 0) return AdminConstant.SUCCESS; else return AdminConstant.FAILED; } // DELETE: api/UpdateProfile/5 public void Delete(int id) { } } }