-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathHouseModel.cs
35 lines (29 loc) · 937 Bytes
/
HouseModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace Catel.Examples.NestedUserControls.Models
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Data;
public class HouseModel : ValidatableModelBase
{
public HouseModel()
{
Rooms = new ObservableCollection<RoomModel>();
}
public HouseModel(string name, decimal price)
: this()
{
Name = name;
Price = price;
}
public string Name { get; set; }
public decimal Price { get; set; }
public ObservableCollection<RoomModel> Rooms { get; set; }
protected override void ValidateFields(List<IFieldValidationResult> validationResults)
{
if (string.IsNullOrWhiteSpace(Name))
{
validationResults.Add(FieldValidationResult.CreateError(nameof(Name), "Name of house is required"));
}
}
}
}