Exemplo n.º 1
0
        public async Task HandleAsync(NotificationArchiveCommand command)
        {
            var notification = await _context.Notification.FirstOrDefaultAsync(x => x.Id == command.Id);

            notification.ExpiresAt = DateTime.Now.AddDays(-1);
            await _context.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Archive(int courseId, NotificationArchiveCommand command)
        {
            if (!_userResolver.HasCoursePrivilege(courseId, new List <PrivilegeEnum>()
            {
                PrivilegeEnum.CanManageCourse, PrivilegeEnum.CanManageNotifications, PrivilegeEnum.CanArchiveNotifications
            }))
            {
                return(Unauthorized());
            }
            await _commandBus.ExecuteAsync(command);

            return(Ok());
        }