UpdateProfileController.cs
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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<string> 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)
{
}
}
}