public ActionResult Index(FormCollection collection) { try { var FilterData = new FilterModel { TypeSort = collection["TypeSort"] }; if (FilterData.Save()) { string TypeOfSort = Storage.Instance.Type; switch (TypeOfSort) { case "SortName": var AnonymousClient = new ClientsModel(); if (AnonymousClient.SortName()) { return(RedirectToAction("SortName")); } break; case "SortLastName": var AnonymousSecondClient = new ClientsModel(); if (AnonymousSecondClient.SortLastName()) { return(RedirectToAction("SortLastName")); } break; } } return(RedirectToAction("Index")); } catch { return(View()); } }