50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using GazpromApp.Models;
|
|
|
|
namespace GazpromApp.ViewModels;
|
|
|
|
public partial class PointViewModel : ViewModelBase
|
|
{
|
|
[ObservableProperty]
|
|
private string? _name;
|
|
|
|
[ObservableProperty]
|
|
private string? _description;
|
|
|
|
[ObservableProperty]
|
|
private double? _latitude;
|
|
|
|
[ObservableProperty]
|
|
private double? _longitude;
|
|
|
|
// EF stuff
|
|
[ObservableProperty]
|
|
private List<Image>? _images;
|
|
[ObservableProperty]
|
|
private List<Equipment>? _equipment;
|
|
[ObservableProperty]
|
|
private List<Property>? _properties;
|
|
|
|
public PointViewModel(Models.Point point)
|
|
{
|
|
Name = point.Name;
|
|
Description = point.Description;
|
|
Latitude = point.Latitude;
|
|
Longitude = point.Longitude;
|
|
Images = point.Images;
|
|
Equipment = point.Equipment;
|
|
Properties = point.Properties;
|
|
}
|
|
|
|
public Models.Point GetPoint()
|
|
{
|
|
return new Models.Point()
|
|
{
|
|
Name = this.Name,
|
|
Description = this.Description,
|
|
Equipment = this.Equipment ?? [],
|
|
Properties = this.Properties ?? [],
|
|
};
|
|
}
|
|
} |