public IActionResult HandlePageRequest <TKey, TEntity>( Action <TEntity> setPageEntity, Func < IRepository <TEntity>, RoutineClosure <TUserContext>, Func < Func < Func <bool>, Func <string, ValuableResult <TKey> >, Func <TKey, TEntity>, IActionResult>, IActionResult> > action ) where TEntity : class => PageRoutineHandler.Handle((container, closure) => container.HandleRepository <IActionResult, TEntity>(repository => MvcHandler.MakeActionResultOnRequest( repository, () => PageModel.Unauthorized(), PageModel.HttpContext.Request, o => { setPageEntity(o); return(PageModel.Page()); }, (m) => { return(PageModel.BadRequest()); }, PageModel.NotFound, (r) => action(r, closure) ) ) );
public Task <IActionResult> HandlePageRequestAsync <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.HandleAsync(async(container, closure) => await container.HandleRepositoryAsync <IActionResult, TEntity>(repository => Task.Run(() => 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) ) ) ) );