mirror of
https://github.com/rudollee/LearningMVC.git
synced 2026-08-11 16:32:55 +00:00
Ch. 21 Helper Methods
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using HelperMethods.Models;
|
||||
|
||||
namespace HelperMethods.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.Fruits = new string[] { "Spple", "Orange", "Pear" };
|
||||
ViewBag.Cities = new string[] { "New York", "London", "Paris" };
|
||||
|
||||
string message = "This is an HTML element: <input>";
|
||||
|
||||
return View((object)message);
|
||||
}
|
||||
|
||||
public ActionResult CreatePerson()
|
||||
{
|
||||
return View(new Person());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult CreatePerson(Person Person)
|
||||
{
|
||||
return View(Person);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user