blob: 1c948d81a09d53e7419f36026a55f64dadc0d720 (
plain) (
blame)
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
|
namespace IOL.GreatOffice.Api.Models.Misc;
public class KnownProblemModel
{
public KnownProblemModel(string title = default, string subtitle = default, Dictionary<string, string[]> errors = default)
{
Title = title;
Subtitle = subtitle;
Errors = errors ?? new();
}
public string Title { get; set; }
public string Subtitle { get; set; }
public Dictionary<string, string[]> Errors { get; set; }
public string TraceId { get; set; }
public void AddError(string field, string errorText)
{
if (!Errors.ContainsKey(field))
{
Errors.Add(field, [errorText]);
}
else
{
var currentErrors = Errors[field];
var newErrors = currentErrors.Concat(new[] { errorText });
Errors.Remove(field);
Errors.Add(field, newErrors.ToArray());
}
}
}
|