Skip to content

Commit

Permalink
Close GH-11 Introduce Now and UtcNow props
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-yagodin committed Mar 16, 2018
1 parent bed8703 commit 87be3b4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion R7.Dnn.Extensions/ViewModels/ViewModelContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Author:
// Roman M. Yagodin <[email protected]>
//
// Copyright (c) 2015-2017 Roman M. Yagodin
// Copyright (c) 2015-2018 Roman M. Yagodin
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -19,6 +19,8 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Web;
using System.Web.UI;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Modules;
Expand All @@ -43,6 +45,16 @@ public class ViewModelContext
/// <value>The module instance context.</value>
public ModuleInstanceContext Module { get; protected set; }

/// <summary>
/// Gets the initial timestamp of the current HTTP request.
/// </summary>
public DateTime Now => HttpContext.Current.Timestamp;

/// <summary>
/// Gets the initial timestamp of the current HTTP request in UTC.
/// </summary>
public DateTime UtcNow => HttpContext.Current.Timestamp.ToUniversalTime ();

/// <summary>
/// Initializes a new instance of the <see cref="T:R7.Dnn.Extensions.ViewModels.ViewModelContext"/> class.
/// </summary>
Expand Down

0 comments on commit 87be3b4

Please sign in to comment.