[#61] Windows: Use red and green color to indicate type of WineVariety
All checks were successful
Test / Run tests (push) Successful in 2m17s
All checks were successful
Test / Run tests (push) Successful in 2m17s
This commit is contained in:
@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
@ -118,6 +119,9 @@ namespace Elwig.Models.Entities {
|
||||
public string SortIdString => string.Join(", ", SortIds);
|
||||
public string FilteredSortIdString => string.Join(", ", FilteredSortIds);
|
||||
|
||||
public Brush? Color => Parts.Select(p => p.Variety.Color).Distinct().SingleOrDefault();
|
||||
public Brush? FilteredColor => FilteredParts.Select(p => p.Variety.Color).Distinct().SingleOrDefault();
|
||||
|
||||
public IEnumerable<string> Modifiers => Parts
|
||||
.SelectMany(p => p.Modifiers)
|
||||
.Select(m => m.Name)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
[Table("wine_variety"), PrimaryKey("SortId")]
|
||||
@ -20,6 +21,7 @@ namespace Elwig.Models.Entities {
|
||||
|
||||
public bool IsRed => Type == "R";
|
||||
public bool IsWhite => Type == "W";
|
||||
public Brush? Color => IsWhite ? Brushes.DarkGreen : IsRed ? Brushes.DarkRed : null;
|
||||
|
||||
public WineVar() { }
|
||||
|
||||
|
Reference in New Issue
Block a user