private NotificationFilter ConvertFilterDTOToFilterEntity(Notification_NotificationFilterDTO Notification_NotificationFilterDTO) { NotificationFilter NotificationFilter = new NotificationFilter(); NotificationFilter.Selects = NotificationSelect.ALL; NotificationFilter.Skip = Notification_NotificationFilterDTO.Skip; NotificationFilter.Take = Notification_NotificationFilterDTO.Take; NotificationFilter.OrderBy = Notification_NotificationFilterDTO.OrderBy; NotificationFilter.OrderType = Notification_NotificationFilterDTO.OrderType; NotificationFilter.Id = Notification_NotificationFilterDTO.Id; NotificationFilter.Title = Notification_NotificationFilterDTO.Title; NotificationFilter.Content = Notification_NotificationFilterDTO.Content; NotificationFilter.OrganizationId = Notification_NotificationFilterDTO.OrganizationId; NotificationFilter.NotificationStatusId = Notification_NotificationFilterDTO.NotificationStatusId; return(NotificationFilter); }
public async Task <ActionResult <int> > Count([FromBody] Notification_NotificationFilterDTO Notification_NotificationFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } NotificationFilter NotificationFilter = ConvertFilterDTOToFilterEntity(Notification_NotificationFilterDTO); NotificationFilter = NotificationService.ToFilter(NotificationFilter); int count = await NotificationService.Count(NotificationFilter); return(count); }
public async Task <ActionResult <List <Notification_NotificationDTO> > > List([FromBody] Notification_NotificationFilterDTO Notification_NotificationFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } NotificationFilter NotificationFilter = ConvertFilterDTOToFilterEntity(Notification_NotificationFilterDTO); NotificationFilter = NotificationService.ToFilter(NotificationFilter); List <Notification> Notifications = await NotificationService.List(NotificationFilter); List <Notification_NotificationDTO> Notification_NotificationDTOs = Notifications .Select(c => new Notification_NotificationDTO(c)).ToList(); return(Notification_NotificationDTOs); }