Last active
September 22, 2017 19:17
-
-
Save ardacetinkaya/6f4ea085fb81d6822bf386175650a93e to your computer and use it in GitHub Desktop.
Code examples that is used on http://www.minepla.net/2017/09/asp-net-core-razor-pages-nedir/
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using HelloRazor.Model; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.RazorPages; | |
namespace HelloRazor.Pages | |
{ | |
public class IndexModel : PageModel | |
{ | |
public DateTime Today | |
{ | |
get | |
{ | |
return DateTime.Now; | |
} | |
} | |
public void OnPost() | |
{ | |
} | |
public void OnGet(int id = 0) | |
{ | |
} | |
} | |
} |
This file contains 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
@page | |
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | |
@using HelloRazor.Pages | |
@using HelloRazor.Model | |
@using Microsoft.AspNetCore.Mvc.RazorPages | |
@model IndexModel | |
@{ | |
ViewData["Title"] = "Home page"; | |
} | |
@functions | |
{ | |
public class IndexModel : PageModel | |
{ | |
public DateTime Today | |
{ | |
get | |
{ | |
return DateTime.Now; | |
} | |
} | |
public void OnPost() | |
{ | |
} | |
public void OnGet(int id = 0) | |
{ | |
} | |
} | |
} | |
<div> | |
Hello, | |
<br /> | |
This is first Razor Page<span>Current datetime : @Model.Today </span> | |
<br /> | |
<a asp-page="./Contact/SendMail" >Contact for more info</a> | |
<br /> | |
</div> |
This file contains 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
@page | |
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | |
@using HelloRazor.Pages | |
@using HelloRazor.Model | |
@model IndexModel | |
@{ | |
ViewData["Title"] = "Home page"; | |
} | |
<div> | |
Hello, | |
<br /> | |
This is first Razor Page<span>Current datetime : @Model.Today </span> | |
<br /> | |
<a asp-page="./Contact/SendMail" >Contact for more info</a> | |
<br /> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment