현재 웹 응용 프로그램에서 일부 자연어 구문 분석에 대한 설정 중 일부 설정을 사용자가 수정할 수 있도록 허용하려고합니다.다른 작업에서 사용할 사용자 정의 구성 설정 저장
그러나 이러한 설정을 전달하는 방법에 대해 혼란스러워합니다. 사용자가 홈 페이지에서 설정 페이지로 이동하고 양식 제출시 사용자가 행복하게 검색 할 수있는 홈 페이지로 다시 이동합니다.
관련 코드는 다음과 같습니다
public ActionResult Settings(Configuration configuration)
{
TempData["configStructure"] = configurationStructure;
return RedirectToAction("ConfigSet", "Home", configuration);
}
그리고 홈 컨트롤러 :
public ActionResult ConfigSet(Configuration configuration)
{
return View("Index");
}
내가 가진 부분도 발생 해요 : 렌더링 부분보기로
public PartialViewResult Search(string q)
{
List<Stuff> results = this.Search(q);
return PartialView("SearchResults", results);
}
을 이렇게 :
@model MyApp.MySettings.ConfigurationApi
@if (Model == null)
{
using (Ajax.BeginForm("Search", "Home", new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "searchResults",
}))
{
<input type="text" name="q" />
<input type="submit" value="Search" />
}
}
else
{
using (Ajax.BeginForm("Search", "Home", new { configuration = Model }, new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "searchResults",
}))
{
<input type="hidden" name="configuration" />
<input type="text" name="searchString" />
<input type="submit" value="Search" />
}
}
기본적으로 설정 페이지에서 홈 페이지로이 값을 전달하고 해당 사용자에게 설정을 연결하는 방법에 대해 혼란스러워합니다.