public IActionResult Handle(Func <IRepository <TEntity>, RoutineClosure <TUserContext>, IActionResult> func
                             )
 {
     return(pageRoutineHandler.Handle((container, closure) => container.HandleRepository <IActionResult, TEntity>(
                                          repository => func(repository, closure)
                                          )));
 }
Beispiel #2
0
        public IActionResult HandlePageRequest <TKey, TEntity>(
            Action <TEntity> setPageEntity,
            Func <
                IRepository <TEntity>,
                RoutineClosure <TUserContext>,
                Func <
                    Func <
                        Func <bool>,
                        Func <string, ValuableResult <TKey> >,
                        Func <TKey, TEntity>,
                        Action <TEntity, Action <string, object> >,
                        IActionResult>,
                    IActionResult>
                > action
            ) where TEntity : class =>
        PageRoutineHandler.Handle((container, closure) =>
                                  container.HandleRepository <IActionResult, TEntity>(repository =>
                                                                                      MvcHandler.MakeActionResultOnRequest(
                                                                                          repository,

                                                                                          (n, v) => PageModel.ViewData[n] = v,
                                                                                          () => PageModel.Unauthorized(),
                                                                                          PageModel.HttpContext.Request,
                                                                                          o => {
            setPageEntity(o);
            return(PageModel.Page());
        },
                                                                                          (m) => {
            return(PageModel.BadRequest());
        },
                                                                                          PageModel.NotFound,
                                                                                          (r) => action(r, closure)
                                                                                          )

                                                                                      )
                                  );