Finish Owner Relationship, update races and add first helpers for derived values. Update naming
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using StarsAssistant.Model;
|
||||
|
||||
namespace StarsAssistant.ViewModels;
|
||||
@@ -8,7 +9,7 @@ public partial class PlanetViewModel(Planet planet) : ViewModelBase
|
||||
public static ObservableCollection<PlanetViewModel> LoadAll() {
|
||||
var context = new StarsDatabase("stars.sqlite");
|
||||
var result = new ObservableCollection<PlanetViewModel>();
|
||||
foreach (Planet planet in context.Planets.ToList())
|
||||
foreach (Planet planet in context.Planet.Where(p => p.OwnerId == "Atlantis").ToList())
|
||||
{
|
||||
var vm = new PlanetViewModel(planet);
|
||||
result.Add(vm);
|
||||
@@ -20,7 +21,7 @@ public partial class PlanetViewModel(Planet planet) : ViewModelBase
|
||||
|
||||
public string Name => planet.Name;
|
||||
|
||||
public string Owner => planet.Owner ?? String.Empty;
|
||||
public string Owner => planet.OwnerId ?? String.Empty;
|
||||
|
||||
public int Value => planet.Value ?? 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user