TispRecordImageService.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using AutoMapper;
  2. using Ropin.Inspection.Model.Entities;
  3. using Ropin.Inspection.Model.ViewModel;
  4. using Ropin.Inspection.Repository.Interface;
  5. using Ropin.Inspection.Service.Interface;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace Ropin.Inspection.Service
  12. {
  13. public class TispRecordImageService : ITispRecordImageService
  14. {
  15. private readonly ITispRecordImageRepository _repository;
  16. private readonly IMapper _mapper;
  17. public TispRecordImageService(ITispRecordImageRepository repository, IMapper mapper)
  18. {
  19. _repository = repository;
  20. _mapper = mapper;
  21. }
  22. public async Task CreateOneAsync(TispRecordImageViewModel viewModel)
  23. {
  24. var recordImg = _mapper.Map<TISP_RecordImage>(viewModel);
  25. await _repository.CreateOneAsync(recordImg);
  26. var result = await _repository.SaveAsync();
  27. if (!result)
  28. {
  29. throw new Exception("创建图片失败");
  30. }
  31. }
  32. public Task DeleteAsync(Guid id)
  33. {
  34. throw new NotImplementedException();
  35. }
  36. public Task<TispRecordImageViewModel> GetByIdAsync(Guid id)
  37. {
  38. throw new NotImplementedException();
  39. }
  40. public Task<bool> IsExistAsync(Guid id)
  41. {
  42. throw new NotImplementedException();
  43. }
  44. public Task<int> UpdateOneAsync(TispRecordImageViewModel viewModel, params string[] fields)
  45. {
  46. throw new NotImplementedException();
  47. }
  48. }
  49. }