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(); }
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()); }