Files
survey-beta/survey-beta/Mappers/Profiles/MappingProfile.cs
majed adel 3aabe1a367 PATCH
Refactored DTOs to use AutoMapper instead of manual mapping and made some additional improvements and fixes.
Added : GetAllSurveys&DeleteUser.
2025-02-07 06:40:57 -08:00

23 lines
715 B
C#

using AutoMapper;
using survey_beta.DTOs.Create;
using survey_beta.DTOs.Default;
using survey_beta.DTOs.Response;
using survey_beta.DTOs.Update;
using survey_beta.Models;
public class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<CreateSurveyDto, Survey>().ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateQuestionDto, Question>().ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateChoiceDto, Choice>().ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<Survey, SurveyDto>();
CreateMap<Question, QuestionDto>();
CreateMap<Choice, ChoiceDto>();
CreateMap<UpdateSurveyDto, Survey>();
}
}