public ActionResult Index() { try { var model = new SortAndPageModel { CurrentPageIndex = 1, SortBy = DefaultSortBy, SortDescending = false }; int totalRecords; ViewBag.Unit = _unit.GetAllUnit(out totalRecords); model.TotalRecordCount = totalRecords; ViewBag.SortAndPage = model; return(View()); } catch (Exception ex) { TempData["Error"] = ex.ToString(); return(RedirectToAction("Index", "Error", new { area = "" })); } }