Beispiel #1
0
        public PaginatedElement <Alarm> GetByPool(int id, IFilter <Alarm> filter, int rowsPerPage, int pageNumber, User user = null)
        {
            if (user != null)
            {
                filter = new IdentityAlarmFilter(filter, user);
            }
            IEnumerable <Alarm> alarms = alarmRepository.GetByPool(id, filter, rowsPerPage, pageNumber);
            int totalElementCount      = alarmRepository.CountByPool(id, filter);

            return(new PaginatedElement <Alarm>
            {
                TotalElementCount = totalElementCount,
                Elements = alarms,
                PageCount = RestApiHelper.GetPageCount(totalElementCount, rowsPerPage)
            });
        }
Beispiel #2
0
        public Alarm Get(int id, User user)
        {
            IFilter <Alarm> filter = new AlarmFilter();

            if (user != null)
            {
                filter = new IdentityAlarmFilter(filter, user);
            }
            Alarm alarm = alarmRepository.GetById(id, filter);

            if (alarm == null)
            {
                throw new NotFoundException(typeof(Alarm));
            }

            return(alarm);
        }