Skip to content

Commit

Permalink
Add optional form kind as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleybot committed Jul 3, 2024
1 parent 24de48b commit c0d273b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/UDS.Net.API/Extensions/EntityToDtoMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,16 @@ public static VisitDto ToDto(this Visit visit, string formKind)
return dto;
}

private static void SetBaseFormProperties(this FormDto dto, Form form)
private static void SetBaseFormProperties(this FormDto dto, Form form, string? formKind = "")
{
if (form != null)
{
dto.Id = form.Id;
dto.VisitId = form.VisitId;
dto.Kind = form.GetType().Name;
if (String.IsNullOrWhiteSpace(formKind))
dto.Kind = form.GetType().Name;
else
dto.Kind = formKind;
dto.CreatedAt = form.CreatedAt;
dto.CreatedBy = form.CreatedBy;
dto.ModifiedBy = form.ModifiedBy;
Expand All @@ -160,7 +163,7 @@ private static void SetBaseFormProperties(this FormDto dto, Form form)
public static FormDto ToSummaryDto(this Form form, string formKind)
{
var dto = new FormDto();
dto.SetBaseFormProperties(form);
dto.SetBaseFormProperties(form, formKind);
return dto;
}

Expand Down

0 comments on commit c0d273b

Please sign in to comment.