AccountController.cs 1.29 KB
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 ADAM.AIAHTML5.ADMIN.API.Models;
using System.Web.Http.Cors;
using System.Web.Cors;
using AIAHTML5.Server.Constants;
using log4net;
using System.Text;
using ADAM.AIAHTML5.ADMIN.API.Entity;

namespace ADAM.AIAHTML5.ADMIN.API.Controllers
{
    //[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")]
    [RoutePrefix("Account")]
    public class AccountController : ApiController
    {
        AIADatabaseV5Entities dbContext = new AIADatabaseV5Entities();

        [Route("AccountTypes")]
        [HttpGet]
        public HttpResponseMessage GetAccountTypes()
        {
            List<AccountTypeEntityModel> AccountTypeList = new List<AccountTypeEntityModel>();
            try
            {
                AccountTypeList = AccountTypeEntityModel.GetActiveAccountTypes(dbContext);
                return Request.CreateResponse(HttpStatusCode.OK, AccountTypeList);
            }
            catch (Exception ex)
            {
                // Log exception code goes here  
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
        }

    }
}