コード例 #1
0
        // GET: Home
        //public string Index()
        //{
        //    return "Hello World MVC";
        //}
        //public ActionResult Index(string id)
        //{
        //    if (string.IsNullOrWhiteSpace(id))
        //        return View("Error");
        //    else
        //    {
        //        ViewData["Name"] = id;
        //        return View();
        //    }
        //}
        public ActionResult ListClients()
        {
            Clients clients = new Clients();

            ViewData["Clients"] = clients.GetClientsList();

            return View();
        }
コード例 #2
0
        public ActionResult SearchClient(string id)
        {
            ViewData["Name"] = id;

            Clients clients = new Clients();

            Client client = clients.GetClientsList().FirstOrDefault(c => c.Name == id);

            if (client != null)

            {

                ViewData["Age"] = client.Age;

                return View("Found");

            }

            return View("NotFound");
        }