Код: Выделить всё
public async Task> Handle(Query.GetAppointmentQuery request, CancellationToken cancellationToken)
{
var EventsQuery = GetAppointmentsQuery(request);
var Events = await PagedResult.CreateAsync(EventsQuery,
request.PageIndex, request.PageSize);
var result = mapper.Map(Events);
return Result.Success(result);
}
Код: Выделить всё
CreateMap()
.ForMember(dest => dest.CreatedDate, opt => opt.MapFrom(src => src.CreatedDate.ToString("dd/MM/yyyy")))
.ForMember(dest => dest.UpdatedDate, opt => opt.MapFrom(src => src.UpdatedDate.Value.ToString("dd/MM/yyyy")))
.ReverseMap();
CreateMap
, PagedResult>().ReverseMap();
Код: Выделить всё
public PagedResult(List items, int pageIndex, int pageSize, int totalCount)
{
this.Items = items;
this.PageIndex = pageIndex;
this.PageSize = pageSize;
this.TotalCount = totalCount;
}
Код: Выделить всё
"createdDate": "11/3/2024 1:25:25 PM",
Подробнее здесь: https://stackoverflow.com/questions/791 ... automapper
Мобильная версия