Gui stuff
This commit is contained in:
@ -3,20 +3,20 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UserService.Infrastructure.DataModels;
|
||||
|
||||
namespace UserService.Infrastructure
|
||||
namespace UserService.Infrastructure.DataModels
|
||||
{
|
||||
public static class NodeExtensions
|
||||
{
|
||||
public static void MapFields(this User user, Dictionary<string, object> values)
|
||||
public static void MapFields(this Member member, Dictionary<string, object> values)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||
if (member == null) throw new ArgumentNullException(nameof(member));
|
||||
if (values == null) throw new ArgumentNullException(nameof(values));
|
||||
var properties = user.GetType().GetProperties();
|
||||
var properties = member.GetType().GetProperties();
|
||||
foreach (var keyValuePair in values)
|
||||
{
|
||||
var propertyInfo = properties.FirstOrDefault(x => x.Name == keyValuePair.Key);
|
||||
if (propertyInfo == null) continue;
|
||||
propertyInfo.SetValue(user, keyValuePair.Value);
|
||||
propertyInfo.SetValue(member, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user