I have Multiple ActionResults in my Controller. Almost all of them process either AjaxRequest and normal requests, dependending on the request (duh!). The point is, if I'm adding something to the database using an AjaxRequest, I just want to return a OK or ERROR (or 1 or 0, etc..) to my page instead of a View() or a ParcialView() because I will handle via ajax on the client and I just need a yes or no response (or any other basic response).
If I have a normal request (not ajax), it's fine because I'll either redirect to another controller or return a simple View().
So the question is: what is the best way to return a simple value to my view when processing AjaxRequest()??
// logic to insert into the db (just an example)
result = Person.Add();
if(Request.IsAjaxRequest()) {
if(result == ok)
return true;
else
return false;
}
// Normal Request
else {
if(result == ok)
return Redirect("PersonList");
else
return View("Error:);
}