Skip to content

Commit

Permalink
[#8] Data Action to automatically populate CreateBy from HTTP context
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Kyrylenko committed Nov 20, 2020
1 parent 549fd42 commit 3c1fa85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SafeCity/Mappers/MappingActions/SetAuditDataActionCreate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IdentityModel.Tokens.Jwt;
using AutoMapper;
using Microsoft.AspNetCore.Http;
using SafeCity.Core.Entities;
Expand All @@ -19,8 +20,8 @@ public SetAuditDataActionCreate(IHttpContextAccessor httpContextAccessor)

public void Process(TSource source, TDestination destination, ResolutionContext context)
{
//destination.CreatedBy = _httpContextAccessor.HttpContext.User.FindFirst(JwtRegisteredClaimNames.Email).Value;
destination.CreatedBy = "[email protected]";
destination.CreatedBy = _httpContextAccessor.HttpContext.User.FindFirst(JwtRegisteredClaimNames.Email).Value;
//destination.CreatedBy = "[email protected]";
destination.CreatedDate = DateTime.Now;
}
}
Expand Down

0 comments on commit 3c1fa85

Please sign in to comment.