
using New_College.IServices;
using New_College.Model.Models;
using New_College.Services.BASE;
using New_College.IRepository.Base;
using System.Collections.Generic;
using System.Threading.Tasks;
using New_College.Model.ViewModels;
using System.Linq;
using New_College.Model;
using New_College.Model.ViewModels.Query;
using LinqKit;

namespace New_College.Services
{
    public class V_VipCardTypeServices : BaseServices<V_VipCardType>, IV_VipCardTypeServices
    {
        private readonly IBaseRepository<V_VipCardType> _dal;
        public V_VipCardTypeServices(IBaseRepository<V_VipCardType> dal)
        {
            this._dal = dal;
            base.BaseDal = dal;
        }

        /// <summary>
        /// 获取Vip卡列表
        /// </summary>
        /// <returns></returns>
        public async Task<List<VipCardTypeResult>> GetVipCardTypeList()
        {
            var info = await _dal.Query(x => x.IsDelete == false, "OrderSort desc");
            return info.Select(x => new VipCardTypeResult()
            {
                Id = x.Id,
                Name = x.Name,
                Money = x.Money,
                Desc = x.Desc,
                Day = x.Day
            }).ToList();
        }

        /// <summary>
        /// 获取Vip卡列表
        /// </summary>
        /// <returns></returns>
        public async Task<List<VipCardTypeQuery>> GetVipCardType()
        {
            var info = await _dal.Query(x => x.IsDelete == false, "OrderSort desc");
            return info.Select(x => new VipCardTypeQuery()
            {
                Id = x.Id,
                Name = x.Name,
                Money = x.Money,
                Desc = x.Desc,
                Day = x.Day
            }).ToList();
        }
    }
}
