Created
June 7, 2018 07:41
-
-
Save danielplawgo/08016083664e3ffadfe2f15da3a1a51c to your computer and use it in GitHub Desktop.
T4MVC - sposób na stringi w aplikacji ASP.NET MVC
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
<ul class="nav navbar-nav"> | |
<li>@Html.ActionLink("Home", "Index", "Home")</li> | |
<li>@Html.ActionLink("About", MVC.Home.About())</li> | |
<li>@Html.ActionLink("Contact", MVC.Home.Contact())</li> | |
</ul> |
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 virtual ActionResult Action(int id) | |
{ | |
return Content(id.ToString()); | |
} | |
public virtual ActionResult RedirectToActionUsingString() | |
{ | |
return RedirectToAction("Action", "Home", new { id = 10 }); | |
} | |
public virtual ActionResult RedirectToActionUsingT4MVC() | |
{ | |
return RedirectToAction(MVC.Home.Action(10)); | |
} |
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 virtual ActionResult UseViewNameAsString() | |
{ | |
ViewBag.ActionName = "UseViewNameAsString"; | |
return View("View"); | |
} | |
public virtual ActionResult UseViewNameUsingT4MVC() | |
{ | |
ViewBag.ActionName = ActionNames.UseViewNameUsingT4MVC; // MVC.Home.ActionNames.UseViewNameUsingT4MVC | |
return View(Views.View); | |
} |
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
<div class="row"> | |
<div class="col-md-12"> | |
<img src="@Links.Content.Images.Visual_Studio_2013_Logo_svg_png" /> | |
</div> | |
</div> |
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 class RouteConfig | |
{ | |
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |
routes.MapRoute( | |
name: "IndexRoute", | |
url: "Index", | |
defaults: MVC.Home.Index() | |
); | |
routes.MapRoute( | |
name: "Default", | |
url: "{controller}/{action}/{id}", | |
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment