AjaxExamples.Controllers.SessionsController.Index C# (CSharp) Method

Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            var sessions = _repository.FindAll();

            //for ajax requests, we simply need to render the partial
            if(Request.IsAjaxRequest())
                return View("_sessionList", sessions);

            return View(sessions);
        }