SharedModel.cs 1.64 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 AccountTypeModel
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public bool isActive { get; set; }

        public static List<AccountType> GetAccountTypeList(AIADatabaseV5Entities dbContext, int Id)
        {
            var accountTypeEntity = dbContext.usp_GetAccountTypeList(Id).ToList();
            List<AccountType> AccountTypelist = accountTypeEntity.Select(l => new AccountType() { Id = l.Id, Title = l.Title }).ToList();
            //AccountTypelist.Insert(0, new AccountType { Id = 0, Title = "All" });
            return AccountTypelist;
        }

        public static List<AccountTypeModel> GetAccountTypes(AIADatabaseV5Entities dbContext)
        {
            List<AccountTypeModel> AccountTypeList = new List<AccountTypeModel>();
            AccountTypeModel AccountTypeModelObj = new AccountTypeModel();
            try
            {
                var result = dbContext.EC_GetAccountTypeList().ToList();
                if (result.Count > 0)
                {
                    foreach (var item in result)
                    {
                        AccountTypeModelObj = new AccountTypeModel();
                        AccountTypeModelObj.Id = item.Id;
                        AccountTypeModelObj.Title = item.Title;
                        AccountTypeList.Add(AccountTypeModelObj);
                    }
                }
            }
            catch (Exception ex) { }
            return AccountTypeList;
        }
    }
}