using AutoMapper;
using Ropin.Inspection.Model.Entities;
using Ropin.Inspection.Model.ViewModel;
using Ropin.Inspection.Repository.Interface;
using Ropin.Inspection.Service.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ropin.Inspection.Service
{
    public class TispRecordImageService : ITispRecordImageService
    {
        private readonly ITispRecordImageRepository _repository;
        private readonly IMapper _mapper;
        public TispRecordImageService(ITispRecordImageRepository repository, IMapper mapper)
        {
            _repository = repository;
            _mapper = mapper;
        }
        public async Task CreateOneAsync(TispRecordImageViewModel viewModel)
        {
            var recordImg = _mapper.Map<TISP_RecordImage>(viewModel);
            await _repository.CreateOneAsync(recordImg);
            var result = await _repository.SaveAsync();
            if (!result)
            {
                throw new Exception("创建图片失败");
            }
        }

        public Task DeleteAsync(Guid id)
        {
            throw new NotImplementedException();
        }

        public Task<TispRecordImageViewModel> GetByIdAsync(Guid id)
        {
            throw new NotImplementedException();
        }

        public Task<bool> IsExistAsync(Guid id)
        {
            throw new NotImplementedException();
        }

        public Task<int> UpdateOneAsync(TispRecordImageViewModel viewModel, params string[] fields)
        {
            throw new NotImplementedException();
        }
    }
}