Refactored DTOs to use AutoMapper instead of manual mapping and made some additional improvements and fixes. Added : GetAllSurveys&DeleteUser.
23 lines
715 B
C#
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>();
|
|
}
|
|
}
|