using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Model.Enum;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using SlnMesnac.Common;
using static Dm.net.buffer.ByteArrayBuffer;
using System.Threading.Tasks;

namespace SlnMesnac.Repository.service.Impl
{
    public class data1_TableServiceImpl : BaseServiceImpl<data1_Table>, Idata1_TableService
    {
        private Repository<data1_Table> _repository;
        private ILogger<data1_TableServiceImpl> _logger;
        public data1_TableServiceImpl(Repository<data1_Table> repository, ILogger<data1_TableServiceImpl> logger) :base(repository)
        {
            _repository = repository;
            _logger = logger;
        }

        public async Task<List<data1_Table>> Getdata1TableListAsync()
        {
            List<data1_Table> list = null;
            try
            {
                Expression<Func<data1_Table, bool>> exp = x => true;
                exp = exp.And(x =>
                    (x.flag != "F")
                  );
                 list = _repository.GetList(exp);
            }
            catch (Exception ex)
            {
                _logger.LogError($"量仪数据获取错误:{ex.Message}");
            }
            return list;
        }
       

        public async Task<bool> UpdateAsync(data1_Table record)
        {
            try
            {
                bool result = await _rep.UpdateAsync(record);
                return result;
            }
            catch (Exception ex)
            {
                _logger.LogError($"量仪数据获取错误:{ex.Message}");
                return false;
            }

        }
       
    }
}