Add project files.
This commit is contained in:
		| @@ -0,0 +1,42 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="ModuleMapper.cs"> | ||||
| //    HEATH | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
| using Core.Cerberos.Adapters; | ||||
| using Core.Cerberos.Domain.Contexts.Onboarding.Request; | ||||
| using Microsoft.AspNetCore.Http; | ||||
| using MongoDB.Bson; | ||||
| using System.Security.Claims; | ||||
| namespace Core.Cerberos.Domain.Contexts.Onboarding.Mappers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Handles mappings between | ||||
|     /// <see cref="ModuleRequest"/>, | ||||
|     /// and <see cref="ModuleAdapter"/> | ||||
|     /// </summary> | ||||
|     public static class ModuleMapper | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Maps the permissionRequest to ModuleAdapter. | ||||
|         /// </summary> | ||||
|         /// <param name="newModule">The Module to be mapped.</param> | ||||
|         /// <returns>A <see cref="ModuleAdapter"/> representing | ||||
|         /// the asynchronous execution of the service.</returns> | ||||
|         public static ModuleAdapter ToAdapter(this ModuleRequest newModule, IHttpContextAccessor httpContextAccessor) | ||||
|         { | ||||
|             return new ModuleAdapter | ||||
|             { | ||||
|                 Id = ObjectId.GenerateNewId().ToString(), | ||||
|                 Name = newModule.Name, | ||||
|                 Description = newModule.Description, | ||||
|                 Icon = newModule.Icon, | ||||
|                 Route = newModule.Route, | ||||
|                 Order = newModule.Order, | ||||
|                 Application = newModule.Application, | ||||
|                 CreatedAt = DateTime.UtcNow, | ||||
|                 CreatedBy = httpContextAccessor.HttpContext?.User?.FindFirst(ClaimTypes.Email)?.Value ?? string.Empty, | ||||
|             }; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin