Created
May 7, 2015 18:17
-
-
Save coreypnorris/09b64c45ba6bfe4b206c to your computer and use it in GitHub Desktop.
Return results in MVC controllers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace OdeToFood.Controllers | |
| { | |
| public class CuisineController : Controller | |
| { | |
| // | |
| // GET: /Cuisine/ | |
| public ActionResult Search(string name) | |
| { | |
| var message = Server.HtmlEncode(name); | |
| return Content(message); | |
| return RedirectToAction("Index", "Home", new {name = "French"}); | |
| return RedirectToRoute("Default", new {controller = "Home", action = "About"}); | |
| return Json(new {firstname = "Corey", lastname = "Norris"}, JsonRequestBehavior.AllowGet); | |
| // Note: You can use a File Result to return PDF files, spreadsheets, text files, and other content the user wants to download. | |
| return File(Server.MapPath("~/Content/site.css"), "text/css"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment