ConfigurationController.cs
1.5 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Configuration;
using Newtonsoft.Json;
namespace AIAHTML5.API.Controllers
{
public class ConfigurationController : ApiController
{
[Route("api/Configuration/GetConfigurationvalues")]
[HttpGet]
public HttpResponseMessage GetConfigurationvalues()
{
dynamic responseData;
MyConfig mconfig = new MyConfig();
mconfig.current_year= DateTime.Now.Year;
mconfig.idleTime = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME"]);
mconfig.idelTimeOut = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME_OUT"]);
mconfig.pingInterval = Int32.Parse(ConfigurationManager.AppSettings["PING_INTERVAL"]);
mconfig.serverPath = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"];
mconfig.fileSize = Int32.Parse(ConfigurationManager.AppSettings["UploadMaxFileSize"]);
responseData = JsonConvert.SerializeObject(mconfig);
return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) };
}
}
}
public class MyConfig
{
public int current_year { get; set; }
public int idleTime { get; set; }
public int idelTimeOut { get; set; }
public int pingInterval { get; set; }
public string serverPath { get; set; }
public int fileSize { get; set; }
}