using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.ModuleEnum;
using Siger.Middlelayer.Repository;
using System;
using Siger.Middlelayer.WmsRepository.Entities;
using Siger.Middlelayer.WmsRepository.Repositories.Interface;

namespace Siger.ApiWMS.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    [Route("wms/[controller]/[action]")]
    public class BaseController : AuthController
    {
        public BaseController()
        {

        }
        protected void SaveTrace(Isiger_wms_stock_detailRepository trace, IUnitOfWork unitOfWork,traceType type, siger_wms_stock_detail detail)
        {
            detail.type = (int)type;
            detail.updatetime = DateTime.Now;
            trace.Insert(detail);
            if (unitOfWork.Commit() <= 0)
            {
                throw new BadRequestException(RequestEnum.SaveTraceError);
            }
        }
    }
}