using com.hnshituo.core.webapp.vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class MeterBaseCarService
    {
        /// <summary>
        /// 基础信息查询，保持MeterBaseCar
        /// </summary>
        /// <param name="car"></param>
        /// <returns></returns>
        public RESTfulResult<List<MeterBaseCar>> doQueryCarList(MeterBaseCar car)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterBaseCar>>> rm = db.doOption<PageList<List<MeterBaseCar>>>("meterbasecars", "/", new object[] { car }, 0);

            RESTfulResult<List<MeterBaseCar>> result = new RESTfulResult<List<MeterBaseCar>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Succeed && rm.Data != null && rm.Data.list.Count > 0)
            {
                result.Data = rm.Data.list;
            }
            return result;
        }

        /// <summary>
        /// 基础信息查询，保持MeterBaseCar
        /// </summary>
        /// <param name="car"></param>
        /// <returns></returns>
        public RESTfulResult<MeterBaseCar> addCar(MeterBaseCar car)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<MeterBaseCar> rm = db.doOption<MeterBaseCar>("meterbasecars", "/addByCarNo", new object[] { car }, 1);

            return rm;
        }
    }
}
