Skip to content

Instantly share code, notes, and snippets.

@ardacetinkaya
Last active September 22, 2017 19:17
Show Gist options
  • Save ardacetinkaya/6f4ea085fb81d6822bf386175650a93e to your computer and use it in GitHub Desktop.
Save ardacetinkaya/6f4ea085fb81d6822bf386175650a93e to your computer and use it in GitHub Desktop.
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)
{
}
}
}
@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>
@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