Gui stuff

This commit is contained in:
2020-08-22 21:37:24 +02:00
parent ca983c9d3a
commit f2932ad2e8
6 changed files with 60 additions and 30 deletions

View File

@ -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);
}
}
}