using DeviceRepair.Api.Common;
using DeviceRepair.Api.CustomAttribute;
using DeviceRepair.DataAccess;
using DeviceRepair.Models;
using DeviceRepair.Models.Logs;
using NLog;
using System;
using System.Web.Http;


namespace DeviceRepair.Api.Controllers
{
    [RoutePrefix("Api/Operation")]
    public class OperationController : CFController
    {
        private static readonly Logger log = LogManager.GetCurrentClassLogger();

        /// <summary>
        /// 用户登录登出日志
        /// </summary>
        /// <param name="FilterInfo"></param>
        /// <returns></returns>
        [HttpPost, HttpAuthorize, Route("UserLoginContent")]
        public APIResponseData UserLoginContent(OperationFilterModel FilterInfo)
        {
            APIResponseData apiResponseData = new APIResponseData { Code = -1, Message = "操作失败！" };
            try
            {
                apiResponseData = OperationAccess.Instance.UserLoginContent(FilterInfo);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                apiResponseData.Code = -1;
                apiResponseData.Message = ex.Message;
            }

            return apiResponseData;
        }
    }
}