summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.MalaDireta/ModeloMalaDireta.cs
blob: 9256b0c77f7228ac953e777f3ca7728c72f5d75f (plain)
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
using System;
using System.Collections.Generic;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Helper;
using Gestor.Model.Resources;
using Newtonsoft.Json;

namespace Gestor.Model.Domain.MalaDireta;

public class ModeloMalaDireta : DomainBase, IDomain
{
	public string Assunto { get; set; }

	public string Corpo { get; set; }

	[JsonIgnore]
	public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;

	public List<KeyValuePair<string, string>> Validate()
	{
		List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
		if (string.IsNullOrWhiteSpace(Assunto))
		{
			list.AddValue("Assunto", Messages.Obrigatorio);
		}
		if (string.IsNullOrWhiteSpace(Corpo))
		{
			list.AddValue("Corpo", Messages.Obrigatorio);
		}
		return list;
	}
}