using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authentication;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Linq.Expressions;
using System.Security.Claims;

using Newtonsoft;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;

using XHD.Core.IServices;
using XHD.Core.IRepository;
using XHD.Core.Common;
using XHD.Core.Models;

namespace XHD.Core.View.Controllers
{
    [Authorize]
    public class SysRoleEmpController : Controller
    {
        private readonly ILogger<SysRoleEmpController> _logger;
        private readonly ISys_role_empService _service;

        public SysRoleEmpController(ILogger<SysRoleEmpController> logger, ISys_role_empService service)
        {
            _service = service;
            _logger = logger;
        }

        public async Task<string> Grid(PageView<Sys_role_emp> model)
        {
            Expression<Func<Sys_role_emp, bool>> expression = a => a.empID == Request.Query["empid"];

            var result = await _service.GridAsync(expression, model.Page, model.Limit, "");

            return result.ToString();
        }
    }
}
