1

This is Teacher

public class Teacher

{
    public int Id { get; set; }

    public string Education { get; set; }

    public string Expereince { get; set; }

    public List<Courses> Courses { get; set; }

    public int UserId { get; set; }

    public User Users { get; set; }
}

I have 2 more entities, that I need mapping to DTO

public class AllCourseDto
{
    public string Name { get; set; }

    public string TeacherName { get; set; }

    public string DateStart { get; set; }

    public string DateEnd { get; set;}
}

I want to map Teacher to AllCoursesDTO, could you explain, how I need tune my Mapper, that currently mapping to AllCourseDTO?

Alireza Noori
  • 14,961
  • 30
  • 95
  • 179
Electronik
  • 11
  • 2
  • What you expect to map into each field of course DTO ? – WallSky Blue Sep 04 '17 at 03:13
  • At basic level you would need Mapper.CreateMap() blah blah blah. If you want to map 3 entities into 1 DTO you would need Mapper.CreateMap, xxxDTO>() blah blah blah. – WallSky Blue Sep 04 '17 at 03:26
  • You are looking for solution in the wrong place. AutoMapper should be responsible for *mapping* not for *resolving* your entities. At the moment you do not even have the data you need. – Pawel Maga Sep 04 '17 at 14:43

0 Answers0