mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Domain.Entities;
|
|
|
|
namespace Features.Breweries.Dtos;
|
|
|
|
public static class BreweryDtoMapper
|
|
{
|
|
public static BreweryDto ToDto(this BreweryPost brewery)
|
|
{
|
|
return new BreweryDto
|
|
{
|
|
BreweryPostId = brewery.BreweryPostId,
|
|
PostedById = brewery.PostedById,
|
|
BreweryName = brewery.BreweryName,
|
|
Description = brewery.Description,
|
|
CreatedAt = brewery.CreatedAt,
|
|
UpdatedAt = brewery.UpdatedAt,
|
|
Timer = brewery.Timer,
|
|
Location = brewery.Location is null
|
|
? null
|
|
: new BreweryLocationDto
|
|
{
|
|
BreweryPostLocationId = brewery.Location.BreweryPostLocationId,
|
|
BreweryPostId = brewery.Location.BreweryPostId,
|
|
CityId = brewery.Location.CityId,
|
|
AddressLine1 = brewery.Location.AddressLine1,
|
|
AddressLine2 = brewery.Location.AddressLine2,
|
|
PostalCode = brewery.Location.PostalCode,
|
|
Coordinates = brewery.Location.Coordinates,
|
|
},
|
|
};
|
|
}
|
|
}
|