Skip to content

Commit

Permalink
feat(ResultDetail): add ToStringViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
HamidMolareza committed Dec 21, 2024
1 parent df1eab8 commit 2b8a675
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/OnRails/ResultDetails/ResultDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ public List<T> GetMoreDetailProperties<T>(string? name = null) {
{ nameof(Message), Message }
};

public virtual string ToStringViewModel() {
var sb = new StringBuilder();
sb.AppendLine(Message is null ? Title : $"{Title}: {Message}");

var customFields = CustomFieldsToString();
if (!string.IsNullOrEmpty(customFields))
sb.AppendLine(customFields);

return sb.ToString();
}

public override string ToString() {
var sb = new StringBuilder();

Expand Down

0 comments on commit 2b8a675

Please sign in to comment.