/// <summary> /// getting all peoples fom data base /// </summary> /// <returns>view with people list</returns> // GET: User public ActionResult Index() { using (UserM user = new UserM()) { return(View(user.GetAll().ToList())); } }
public ActionResult Index(string IdOrName) { using (UserM user = new UserM()) { int uid; bool isNumeric = int.TryParse(IdOrName, out uid); if (isNumeric == true) { return(View(user.GetByIdNum(uid).ToList())); } else if (isNumeric == false && IdOrName != null && IdOrName != "") { return(View(user.GetbyName(IdOrName).ToList())); } return(View(user.GetAll().ToList())); } }