MiscService.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #endregion
  15. #region Ctor
  16. /// <summary>
  17. /// Initializes a new instance of the MiscService class
  18. /// </summary>
  19. public MiscService(
  20. IRepository<MailNotification> mailNotificationRepository)
  21. {
  22. _mailNotificationRepository = mailNotificationRepository;
  23. }
  24. #endregion
  25. #region MailNotification
  26. /// <summary>
  27. /// Gets all mailNotifications
  28. /// </summary>
  29. public IList<MailNotification> GetAllMailNotifications()
  30. {
  31. return _mailNotificationRepository.Table.ToList();
  32. }
  33. /// <summary>
  34. /// Gets a mailNotification by specified Id
  35. /// </summary>
  36. /// <param name="id">MailNotification identifier.</param>
  37. public MailNotification GetMailNotificationById(int id)
  38. {
  39. return _mailNotificationRepository.GetById(id);
  40. }
  41. /// <summary>
  42. /// Gets all mailNotifications to the specified ids
  43. /// </summary>
  44. public IList<MailNotification> GetMailNotificationsByIds(int[] ids)
  45. {
  46. return _mailNotificationRepository.Table
  47. .Where(u => ids.Contains(u.Id))
  48. .ToList();
  49. }
  50. /// <summary>
  51. /// Insert a mailNotification
  52. /// </summary>
  53. /// <param name="mailNotification">MailNotification.</param>
  54. public void InsertMailNotification(MailNotification mailNotification)
  55. {
  56. _mailNotificationRepository.Insert(mailNotification);
  57. }
  58. /// <summary>
  59. /// Update a mailNotification
  60. /// </summary>
  61. /// <param name="mailNotification">MailNotification.</param>
  62. public void UpdateMailNotification(MailNotification mailNotification)
  63. {
  64. _mailNotificationRepository.Update(mailNotification);
  65. }
  66. /// <summary>
  67. /// Delete a mailNotification
  68. /// </summary>
  69. /// <param name="mailNotification">MailNotification.</param>
  70. public void DeleteMailNotification(MailNotification mailNotification)
  71. {
  72. _mailNotificationRepository.Delete(mailNotification);
  73. }
  74. #endregion
  75. }
  76. }