MiscService.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using GreenTree.Nachtragsmanagement.Core.Data;
  7. using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
  8. namespace GreenTree.Nachtragsmanagement.Services.Misc
  9. {
  10. public class MiscService : IMiscService
  11. {
  12. #region Fields
  13. private readonly IRepository<MailNotification> _mailNotificationRepository;
  14. private readonly IRepository<HelpPage> _helpPageRepository;
  15. #endregion
  16. #region Ctor
  17. /// <summary>
  18. /// Initializes a new instance of the MiscService class
  19. /// </summary>
  20. public MiscService(
  21. IRepository<MailNotification> mailNotificationRepository,
  22. IRepository<HelpPage> helpPageRepository)
  23. {
  24. _mailNotificationRepository = mailNotificationRepository;
  25. _helpPageRepository = helpPageRepository;
  26. }
  27. #endregion
  28. #region MailNotification
  29. /// <summary>
  30. /// Gets all mailNotifications
  31. /// </summary>
  32. public IList<MailNotification> GetAllMailNotifications()
  33. {
  34. return _mailNotificationRepository.Table.ToList();
  35. }
  36. /// <summary>
  37. /// Gets a mailNotification by specified Id
  38. /// </summary>
  39. /// <param name="id">MailNotification identifier.</param>
  40. public MailNotification GetMailNotificationById(int id)
  41. {
  42. return _mailNotificationRepository.GetById(id);
  43. }
  44. /// <summary>
  45. /// Gets all mailNotifications to the specified ids
  46. /// </summary>
  47. public IList<MailNotification> GetMailNotificationsByIds(int[] ids)
  48. {
  49. return _mailNotificationRepository.Table
  50. .Where(u => ids.Contains(u.Id))
  51. .ToList();
  52. }
  53. /// <summary>
  54. /// Insert a mailNotification
  55. /// </summary>
  56. /// <param name="mailNotification">MailNotification.</param>
  57. public void InsertMailNotification(MailNotification mailNotification)
  58. {
  59. _mailNotificationRepository.Insert(mailNotification);
  60. }
  61. /// <summary>
  62. /// Update a mailNotification
  63. /// </summary>
  64. /// <param name="mailNotification">MailNotification.</param>
  65. public void UpdateMailNotification(MailNotification mailNotification)
  66. {
  67. _mailNotificationRepository.Update(mailNotification);
  68. }
  69. /// <summary>
  70. /// Delete a mailNotification
  71. /// </summary>
  72. /// <param name="mailNotification">MailNotification.</param>
  73. public void DeleteMailNotification(MailNotification mailNotification)
  74. {
  75. _mailNotificationRepository.Delete(mailNotification);
  76. }
  77. #endregion
  78. #region HelpPage
  79. /// <summary>
  80. /// Gets all helpPages
  81. /// </summary>
  82. public IList<HelpPage> GetAllHelpPages()
  83. {
  84. return _helpPageRepository.Table.ToList();
  85. }
  86. /// <summary>
  87. /// Gets a helpPage by specified Id
  88. /// </summary>
  89. /// <param name="id">HelpPage identifier.</param>
  90. public HelpPage GetHelpPageById(int id)
  91. {
  92. return _helpPageRepository.GetById(id);
  93. }
  94. /// <summary>
  95. /// Gets all helpPages to the specified ids
  96. /// </summary>
  97. public IList<HelpPage> GetHelpPagesByIds(int[] ids)
  98. {
  99. return _helpPageRepository.Table
  100. .Where(u => ids.Contains(u.Id))
  101. .ToList();
  102. }
  103. /// <summary>
  104. /// Insert a helpPage
  105. /// </summary>
  106. /// <param name="helpPage">HelpPage.</param>
  107. public void InsertHelpPage(HelpPage helpPage)
  108. {
  109. _helpPageRepository.Insert(helpPage);
  110. }
  111. /// <summary>
  112. /// Update a helpPage
  113. /// </summary>
  114. /// <param name="helpPage">HelpPage.</param>
  115. public void UpdateHelpPage(HelpPage helpPage)
  116. {
  117. _helpPageRepository.Update(helpPage);
  118. }
  119. /// <summary>
  120. /// Delete a helpPage
  121. /// </summary>
  122. /// <param name="helpPage">HelpPage.</param>
  123. public void DeleteHelpPage(HelpPage helpPage)
  124. {
  125. _helpPageRepository.Delete(helpPage);
  126. }
  127. #endregion
  128. }
  129. }