You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OptifitWebService/Server/Mappers/EventsMappers.cs

32 lines
791 B

using Infrastructure.Entities;
using Server.Dto.Request;
using Server.Dto.Response;
namespace Server.Mappers;
public static class EventsMappers
{
public static ResponseEventDto ToDto(this EventEntity evt)
{
return new ResponseEventDto
{
Id = evt.Id,
Title = evt.Title,
Description = evt.Description,
Date = evt.Date,
nbMaxRegistrations = evt.nbPlaces,
nbRegistrations = evt.Participants.Count
};
}
public static EventEntity ToEntity(this RequestEventDto evt)
{
return new EventEntity
{
Title = evt.Title,
Description = evt.Description,
Date = evt.Date,
nbPlaces = evt.nbMaxRegistrations
};
}
}