using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GreenTree.Nachtragsmanagement.Core.Data; using GreenTree.Nachtragsmanagement.Core.Domain.Misc; namespace GreenTree.Nachtragsmanagement.Services.Misc { public class MiscService : IMiscService { #region Fields private readonly IRepository _mailNotificationRepository; private readonly IRepository _notificationEventRepository; private readonly IRepository _notificationEventTypeRepository; #endregion #region Ctor /// /// Initializes a new instance of the MiscService class /// public MiscService( IRepository mailNotificationRepository, IRepository notificationEventRepository, IRepository notificationEventTypeRepository) { _mailNotificationRepository = mailNotificationRepository; _notificationEventRepository = notificationEventRepository; _notificationEventTypeRepository = notificationEventTypeRepository; } #endregion #region MailNotification /// /// Gets all mailNotifications /// public IList GetAllMailNotifications() { return _mailNotificationRepository.Table.ToList(); } /// /// Gets a mailNotification by specified Id /// /// MailNotification identifier. public MailNotification GetMailNotificationById(int id) { return _mailNotificationRepository.GetById(id); } /// /// Gets all mailNotifications to the specified ids /// public IList GetMailNotificationsByIds(int[] ids) { return _mailNotificationRepository.Table .Where(u => ids.Contains(u.Id)) .ToList(); } /// /// Insert a mailNotification /// /// MailNotification. public void InsertMailNotification(MailNotification mailNotification) { _mailNotificationRepository.Insert(mailNotification); } /// /// Update a mailNotification /// /// MailNotification. public void UpdateMailNotification(MailNotification mailNotification) { _mailNotificationRepository.Update(mailNotification); } /// /// Delete a mailNotification /// /// MailNotification. public void DeleteMailNotification(MailNotification mailNotification) { _mailNotificationRepository.Delete(mailNotification); } #endregion #region NotificationEvent /// /// Gets all notificationEvents /// public IList GetAllNotificationEvents() { return _notificationEventRepository.Table.ToList(); } /// /// Gets a notificationEvent by specified Id /// /// NotificationEvent identifier. public NotificationEvent GetNotificationEventById(int id) { return _notificationEventRepository.GetById(id); } /// /// Gets all notificationEvents to the specified ids /// public IList GetNotificationEventsByIds(int[] ids) { return _notificationEventRepository.Table .Where(r => ids.Contains(r.Id)) .ToList(); } /// /// Insert a mailNotification /// /// NotificationEvent. public void InsertNotificationEvent(NotificationEvent notificationEvent) { _notificationEventRepository.Insert(notificationEvent); } /// /// Update a notificationEvent /// /// NotificationEvent. public void UpdateNotificationEvent(NotificationEvent notificationEvent) { _notificationEventRepository.Update(notificationEvent); } /// /// Delete a notificationEvent /// /// NotificationEvent. public void DeleteNotificationEvent(NotificationEvent notificationEvent) { _notificationEventRepository.Delete(notificationEvent); } #endregion #region NotificationEventType /// /// Gets all notificationEventTypes /// public IList GetAllNotificationEventTypes() { return _notificationEventTypeRepository.Table.ToList(); } /// /// Gets a notificationEventType by specified Id /// /// NotificationEventType identifier. public NotificationEventType GetNotificationEventTypeById(int id) { return _notificationEventTypeRepository.GetById(id); } /// /// Gets all notificationEventTypes to the specified ids /// public IList GetNotificationEventTypesByIds(int[] ids) { return _notificationEventTypeRepository.Table .Where(r => ids.Contains(r.Id)) .ToList(); } /// /// Insert a appendix /// /// NotificationEventType. public void InsertNotificationEventType(NotificationEventType notificationEventType) { _notificationEventTypeRepository.Insert(notificationEventType); } /// /// Update a notificationEventType /// /// NotificationEventType. public void UpdateNotificationEventType(NotificationEventType notificationEventType) { _notificationEventTypeRepository.Update(notificationEventType); } /// /// Delete a notificationEventType /// /// NotificationEventType. public void DeleteNotificationEventType(NotificationEventType notificationEventType) { _notificationEventTypeRepository.Delete(notificationEventType); } #endregion } }