CernerUserSessionController.cs 1.64 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using AIAHTML5.API.Models;
using eLearningPlayer.model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace AIAHTML5.API.Controllers
{
    public class CernerUserSessionController : ApiController
    {
        // GET api/<controller>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        public HttpResponseMessage Get(int id)
        {
            var db = new DBModel();
            var result = db.GetAIAImageIdWithJsonCerner(id);

            HttpResponseMessage response = null;
            response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(result)) };
            return response;
        }

        // POST api/<controller>
        public void Post([FromBody] string CernerSessionValues)
        {
            var cernerUserSessionInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<CernerUserSessionInfo>(CernerSessionValues);
            var db = new DBModel();
            var result = db.SaveCernerFhirSessionInfo(cernerUserSessionInfo);

            HttpResponseMessage response = null;
            response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = null };
            //return response;
        }
        
        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
    }
}