You are developing an ASP.NET MVC application that enables you to edit and save a student object. The application must not retrieve student objects on an HTTP POST request. You need to implement the controller. Which code segment should you use? (Each correct answer presents a complete solution. Choose all that apply.)
A. public ActionResult EditStudent(int id, Student s)
{
if (this.HttpContext.Request["ActionName"] == "GET")
{
c=RetrieveStudent(id)
}
}
B.
[ActionName("GET")]
public ActionResult EditStudent(int id)
{
var c=RetrieveStudent(id);
return View(s);
}
[ActionName("POST")]
public ActionResult EditStudent(int id, Student s)
{
SaveStudent(s);
return View(s);
}
C.
[HttpGet]
public ActionResult EditStudent(int id)
{
var c=RetrieveStudent(id);
return View(s);
}
[HttpPost]
public ActionResult EditStudent(int id, Student s)
{
SaveStudent(s);
return View(s);
}
D.
public ActionResult EditStudent(int id, Student s)
{
if (this.HttpContext.Request.RequestType == "GET")
{
c=RetrieveStudent(id)
}
}
if (this.HttpContext.Request.RequestType=="POST")
{