TmtnSpotDevOpsContentRepository.cs 1.4 KB

123456789101112131415161718192021222324252627282930
  1. using Ropin.Inspection.Model.Entities;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Ropin.Inspection.Repository
  8. {
  9. public class TmtnSpotDevOpsContentRepository : RepositoryBase<TMTN_SpotDevOpsContent, Guid>, ITmtnSpotDevOpsContentRepository
  10. {
  11. public TmtnSpotDevOpsContentRepository(InspectionDbContext DbContext) : base(DbContext)
  12. {
  13. }
  14. public Task<int> DeleteBySpotIdAsync(string spotId)
  15. {
  16. MySqlConnector.MySqlParameter[] parameters = new[] { new MySqlConnector.MySqlParameter("Id", spotId) };
  17. int result = EntityFrameworkCoreExtensions.ExecuteSqlNoQuery(DbContext.Database, "DELETE from TMTN_SpotDevOpsContent WHERE C_SpotCode = @Id", parameters);
  18. return Task.FromResult(result);
  19. }
  20. public IEnumerable<TMTN_DevOpsContent> GetBySpotCodeAsync(string id)
  21. {
  22. MySqlConnector.MySqlParameter[] parameters = new[] { new MySqlConnector.MySqlParameter("Id", id)};
  23. var contentlist = EntityFrameworkCoreExtensions.SqlQuery<TMTN_DevOpsContent>(DbContext.Database, "select A.* from TMTN_DevOpsContent A, TISP_Spot B ,TMTN_SpotDevOpsContent C WHERE A.C_ID = C.C_DevOpsContentCode AND B.C_Code = C.C_SpotCode AND C.C_SpotCode = @Id", parameters);
  24. return contentlist;
  25. }
  26. }
  27. }