Compare commits
3 Commits
935f026c75
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8df4abc8a3 | ||
|
|
bf69880d5f | ||
|
|
c6178ecacd |
@@ -42,7 +42,12 @@ namespace FoodsharingSiegen.Contracts.Entity
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Groups)) return new List<UserGroup>();
|
||||
var stringList = Groups.Split(",");
|
||||
var enumList = stringList.Where(x => !string.IsNullOrWhiteSpace(x)).Select(Enum.Parse<UserGroup>).ToList();
|
||||
var enumList = stringList
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.Select(x => Enum.TryParse<UserGroup>(x.Trim(), out var result) ? result : (UserGroup?)null)
|
||||
.Where(x => x.HasValue)
|
||||
.Select(x => x!.Value)
|
||||
.ToList();
|
||||
return enumList;
|
||||
}
|
||||
set => Groups = string.Join(",", value);
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace FoodsharingSiegen.Contracts.Helper
|
||||
{
|
||||
var type = enumVal.GetType();
|
||||
var memInfo = type.GetMember(enumVal.ToString());
|
||||
if (memInfo.Length == 0) return null;
|
||||
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
|
||||
return attributes.Length > 0 ? (T)attributes[0] : null;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="col">
|
||||
<Field>
|
||||
<FieldLabel>Foodsharing-ID</FieldLabel>
|
||||
<NumericEdit TValue="int?" Value="Prospect.FsId" ValueChanged="@((int? v) => Prospect.FsId = v ?? 0)"></NumericEdit>
|
||||
<NumericEdit TValue="int?" Value="@(Prospect.FsId == 0 ? (int?)null : Prospect.FsId)" ValueChanged="@((int? v) => Prospect.FsId = v ?? 0)"></NumericEdit>
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user