protected virtual PartialViewResult AsPartialView <TModel>(ModelBuilderResult <TModel> result, string partialView) { HttpContext.Response.StatusCode = (int)HttpStatusCode.OK; ViewBag.Actions = result.Actions; ViewBag.Message = result.Message; return(PartialView(partialView, result.Data)); }
protected virtual ActionResult AsView <TModel>(ModelBuilderResult <TModel> result) { HttpContext.Response.StatusCode = (int)HttpStatusCode.OK; ViewBag.Actions = result.Actions; ViewBag.Message = result.Message ?? TempData["Message"]; ViewBag.IsSuccess = TempData["IsSuccess"] ?? true; return(View(result.Data)); }
protected virtual PartialViewResult AsPartialView <TModel>(ModelHandlerResult handlerResult, ModelBuilderResult <TModel> builderResult, string partialView) { HttpContext.Response.StatusCode = (int)HttpStatusCode.OK; ViewBag.Message = handlerResult.Message; ViewBag.Actions = handlerResult.Actions; if (handlerResult.IsSuccess) { return(PartialView(partialView, builderResult.Data)); } ModelState.Clear(); AddValidationMessage(handlerResult, null); return(PartialView(partialView, builderResult.Data)); }
/// <summary> /// Předávání výsledků builderu přímo do resultu /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="result"></param> /// <returns></returns> protected virtual IHttpActionResult AsResult <TModel>(ModelBuilderResult <TModel> result) { // rovnou odeslat cely result, aby pomoci JS slo zjistit, zda se vse povedlo, pripadne err! return(Ok(result)); }