Beispiel #1
0
 public IActionResult HandlePageCreate <TEntity>(
     Action <TEntity> setPageEntity,
     Func <
         IRepository <TEntity>,
         RoutineClosure <TUserContext>,
         Func <
             Func <
                 Func <bool>,
                 Func <TEntity>,
                 Action <TEntity, Action <string, object> >,
                 IActionResult>,
             IActionResult>
         > action
     ) where TEntity : class =>
 PageRoutineHandler.Handle((container, closure) =>
                           container.HandleRepository <IActionResult, TEntity>(repository =>
                                                                               MvcHandler.MakeActionResultOnCreate(
                                                                                   repository,
                                                                                   (n, v) => PageModel.ViewData[n] = v,
                                                                                   () => PageModel.Unauthorized(),
                                                                                   PageModel.HttpContext.Request,
                                                                                   o => {
     setPageEntity(o);
     return(PageModel.Page());
 },
                                                                                   (r) => action(r, closure)
                                                                                   )
                                                                               )
                           );
Beispiel #2
0
 public Task <IActionResult> HandlePageCreateAsync <TEntity>(
     Action <object> setPageEntity,
     Func <
         IRepository <TEntity>,
         RoutineClosure <TUserContext>,
         Func <
             Func <
                 Func <bool>,
                 Func <TEntity>,
                 //Action<TEntity, Action<string, object>>,
                 IActionResult>,
             IActionResult>
         > action
     ) where TEntity : class =>
 PageRoutineHandler.HandleAsync(async(container, closure) =>
                                await container.HandleRepositoryAsync <IActionResult, TEntity>(repository =>
                                                                                               Task.Run(
                                                                                                   () => MvcHandler.MakeActionResultOnCreate(
                                                                                                       repository,
                                                                                                       () => PageModel.Unauthorized(),
                                                                                                       PageModel.HttpContext.Request,
                                                                                                       o => {
     setPageEntity(o);
     return(PageModel.Page());
 },
                                                                                                       (r) => action(r, closure)
                                                                                                       ))
                                                                                               )
                                );