using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic;
using System.Text;
using Domain;

namespace Dao.Implement
{
	public class AppMenuRepository : RepositoryBase<AppMenu>, IAppMenuRepository
	{
		public IQueryable<AppMenu> LoadAllByPage(out long total, int page, int rows, string order, string sort)
		{
			var list = this.LoadAll();

			total = list.LongCount();

			list = list.OrderBy(sort + " " + order);
			list = list.Skip((page - 1) * rows).Take(rows);

			return list;
		}

        public IQueryable<AppMenu> LoadAll(int type, int hotelID)
        {
            return this.LoadAll().Where(r => r.Type == type && r.HotelID == hotelID);
        }
	}
}
