Exemple #1
0
        public IActionResult Get([FromServices] IQueryHandlerDispatcher queryHandlerDispatcher)
        {
            var query = new GetAppByIdQuery("AppDisabled", "system.security");
            var dto   = queryHandlerDispatcher.Handle <GetAppByIdQuery, AppDto>(query);

            return(Ok(dto));
        }
Exemple #2
0
        public IActionResult Get([FromServices] IUnitOfWorkFactory unitOfWorkFactory,
                                 [FromServices] IQueryHandlerDispatcher queryHandlerDispatcher,
                                 string criteria = "", int page = 1, int pageSize = 10)
        {
            var query = new SearchPermissionsQuery("corrid", criteria, page, pageSize, "", true);

            var dto = queryHandlerDispatcher.Handle <SearchPermissionsQuery, PaginatedSearchedPermissionDto>(query);

            return(Ok(dto));
        }
Exemple #3
0
        public IActionResult Get([FromServices] IUnitOfWork unitOfWork,
                                 [FromServices] IQueryHandlerDispatcher queryHandlerDispatcher,
                                 string id)
        {
            var query = new GetRoleByIdQuery("corrid", id);

            var dto = queryHandlerDispatcher.Handle <GetRoleByIdQuery, RoleDetailDto>(query);

            return(Ok(dto));
        }
Exemple #4
0
        public async Task <IActionResult> GetNavbarAsync([FromServices] IUnitOfWorkFactory unitOfWorkFactory,
                                                         [FromServices] ICommandHandlerDispatcher commandHandlerDispatcher,
                                                         [FromServices] IQueryHandlerDispatcher queryHandlerDispatcher)
        {
            var unitOfWork = unitOfWorkFactory.Create();

            var cmd = new CreateNotificationCommand("xact", "notif-" + Guid.NewGuid().ToString(), 1, "subject1", "content1", "reference1", DateTime.UtcNow);

            commandHandlerDispatcher.Handle(cmd);

            var query = new GetUnreadNotificationReceiversByUserIdQuery("xact", "system-administrator", "", 1, 10, "", true);
            var dto   = queryHandlerDispatcher.Handle <GetUnreadNotificationReceiversByUserIdQuery, PaginatedNotificationReceiverDto>(query);


            //var items = await notificationService.GetUnreadNotificationsAsync(UserId);
            //var notifications = items.OrderByDescending(p => p.Notification.DateSent).Take(15).ToList();

            ////var items2 = await messageService.GetUnreadMessagesAsync(UserId);
            ////var msgHeaders = items2.Take(15).ToList();

            //var chats = await appDbContext
            //    .ChatReceiverMessages
            //    .Include(p => p.ChatMessage)
            //        .ThenInclude(p => p.Sender)
            //            .ThenInclude(p => p.User)
            //    //.Include(p => p.ChatReceiver)
            //    .Where(p => p.ChatReceiver.ReceiverId == UserId && p.IsRead == false)
            //    .Take(15)
            //    .ToListAsync();

            ////  trigger populate
            ////var chatReceivers = await appDbContext
            ////    .ChatReceivers
            ////    .Where(p => p.ReceiverId == UserId)
            ////    .ToListAsync();


            //var model = new NavbarInfo
            //{
            //    Username = User.Identity.Name,
            //    NotificationReceivers = notifications,
            //    MessageReceiverMessages = chats
            //};


            //return Ok(model);
            unitOfWork.Commit();

            return(Ok(dto));
        }
 public QuestionnaireController(IQueryHandlerDispatcher queryHandlerDispatcher,
     ICommandHandlerDisptcher commandHandlerDisptcher)
 {
     this.queryHandlerDispatcher = queryHandlerDispatcher;
     this.commandHandlerDisptcher = commandHandlerDisptcher;
 }
 public HomeController(ICommandHandlerDisptcher commandHandlerDisptcher,
     IQueryHandlerDispatcher queryHandlerDispatcher)
 {
     this.commandHandlerDisptcher = commandHandlerDisptcher;
     this.queryHandlerDispatcher = queryHandlerDispatcher;
 }