ConfigurationController.cs 1.1 KB
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.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 string serverPath { get; set; }
    public int fileSize { get; set; }
}