CommonModel.cs 3.14 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AIAHTML5.ADMIN.API.Entity;

namespace AIAHTML5.ADMIN.API.Models
{
    public class CountryModel
    {
        public int Id { get; set; }
        public string CountryName { get; set; }
        public string CountryCode { get; set; }

        public static List<CountryModel> GetCountries(AIADatabaseV5Entities dbContext)
        {
            List<CountryModel> CountryList = new List<CountryModel>();
            CountryModel CountryModelObj = new CountryModel();
            try
            {
                var result = dbContext.EC_GetCountryList().ToList();
                if (result.Count > 0)
                {
                    foreach (var item in result)
                    {
                        CountryModelObj = new CountryModel();
                        CountryModelObj.Id = item.Id;
                        CountryModelObj.CountryName = item.CountryName;
                        CountryList.Add(CountryModelObj);
                    }
                }
            }
            catch (Exception ex) { }
            return CountryList;
        }
    }

    public class StateModel
    {
        public int Id { get; set; }
        public string StateName { get; set; }
        public string StateCode { get; set; }

        public static List<StateModel> GetUsStates(AIADatabaseV5Entities dbContext)
        {
            List<StateModel> StateList = new List<StateModel>();
            StateModel StateModelObj = new StateModel();
            try
            {
                var result = dbContext.EC_GetStateList().ToList();
                if (result.Count > 0)
                {
                    foreach (var item in result)
                    {
                        StateModelObj = new StateModel();
                        StateModelObj.Id = item.Id;
                        StateModelObj.StateName = item.StateName;
                        StateList.Add(StateModelObj);
                    }
                }
            }
            catch (Exception ex) { }
            return StateList;
        }
    }

    public class SecurityQuestionModel
    {
        public int Id { get; set; }
        public string Title { get; set; }

        public static List<SecurityQuestionModel> GetSecurityQuestions(AIADatabaseV5Entities dbContext)
        {
            List<SecurityQuestionModel> SecurityQuestionList = new List<SecurityQuestionModel>();
            SecurityQuestionModel SecurityQuestionObj = new SecurityQuestionModel();
            try
            {
                var result = dbContext.EC_GetSecurityQuestionList().ToList();
                if (result.Count > 0)
                {
                    foreach (var item in result)
                    {
                        SecurityQuestionObj = new SecurityQuestionModel();
                        SecurityQuestionObj.Id = item.Id;
                        SecurityQuestionObj.Title = item.Title;
                        SecurityQuestionList.Add(SecurityQuestionObj);
                    }
                }
            }
            catch (Exception ex) { }
            return SecurityQuestionList;
        }
    }
}