Fix #5205: specific the date time as UTC kind.
This commit is contained in:
parent
1770c1ee11
commit
1cba78cc4e
@ -61,6 +61,9 @@ namespace Oqtane.Repository
|
|||||||
|
|
||||||
public UserRole AddUserRole(UserRole userRole)
|
public UserRole AddUserRole(UserRole userRole)
|
||||||
{
|
{
|
||||||
|
userRole.EffectiveDate = userRole.EffectiveDate.HasValue ? DateTime.SpecifyKind(userRole.EffectiveDate.Value, DateTimeKind.Utc) : userRole.EffectiveDate;
|
||||||
|
userRole.ExpiryDate = userRole.ExpiryDate.HasValue ? DateTime.SpecifyKind(userRole.ExpiryDate.Value, DateTimeKind.Utc) : userRole.ExpiryDate;
|
||||||
|
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
db.UserRole.Add(userRole);
|
db.UserRole.Add(userRole);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
@ -84,6 +87,9 @@ namespace Oqtane.Repository
|
|||||||
|
|
||||||
public UserRole UpdateUserRole(UserRole userRole)
|
public UserRole UpdateUserRole(UserRole userRole)
|
||||||
{
|
{
|
||||||
|
userRole.EffectiveDate = userRole.EffectiveDate.HasValue ? DateTime.SpecifyKind(userRole.EffectiveDate.Value, DateTimeKind.Utc) : userRole.EffectiveDate;
|
||||||
|
userRole.ExpiryDate = userRole.ExpiryDate.HasValue ? DateTime.SpecifyKind(userRole.ExpiryDate.Value, DateTimeKind.Utc) : userRole.ExpiryDate;
|
||||||
|
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
db.Entry(userRole).State = EntityState.Modified;
|
db.Entry(userRole).State = EntityState.Modified;
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user