Created
November 2, 2013 05:27
-
-
Save lionhylra/7275878 to your computer and use it in GitHub Desktop.
controller
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
public string Welcome(string name, int numTimes = 1) { | |
return HttpUtility.HtmlEncode("Hello " + name + ", NumTimes is: " + numTimes); | |
} |
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
public ActionResult SearchIndex(string searchString) | |
{ | |
var movies = from m in db.Movies | |
select m; | |
if (!String.IsNullOrEmpty(searchString)) | |
{ | |
movies = movies.Where(s => s.Title.Contains(searchString)); | |
} | |
return View(movies); | |
} |
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
@model MvcMovie.Models.Movie |
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
@{ | |
ViewBag.Title = "Welcome"; | |
} | |
<h2>Welcome</h2> | |
<ul> | |
@for (int i=0; i < ViewBag.NumTimes; i++) { | |
<li>@ViewBag.Message</li> | |
} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment