Merging two model classes into one Dto

46 views
Skip to first unread message

Kwasi Denkyira

unread,
Nov 6, 2015, 9:24:39 PM11/6/15
to AutoMapper-users
I have two entity model classes as below. I want to merge them into one Dto and for ViewModel but I can't seem to figure out the correct way to map it and call AutoMapper in my controller.
public partial class Role  
    {
                
        public int Id { get; set; }
        
        public int Permission_Id { get; set; }
         
        public int User_Id { get; set; }
        
        public PERMISSION PERMISSION { get; set; }
        public ROLE ROLE { get; set; }

        public USER USER { get; set; }
}
 
      public class Bussiness  
    {
 
        public int BussinessId { get; set; }

        public int ProductID { get; set; }

        public int StatusId { get; set; }

        public int TypeId { get; set; }

         

        public int? YearTypeID { get; set; }

         
        public int? DocumentId { get; set; }

         
        public string Name { get; set; }      
       
        public string Number { get; set; }
 
        public string Description { get; set; }
        
        public DateTime StartDate { get; set; }
         
        public DateTime EndDate { get; set; }
         
        public DateTime InsertDate { get; set; }

        public int InsertAccountId { get; set; }
}

Jimmy Bogard

unread,
Nov 9, 2015, 8:56:56 AM11/9/15
to automapper-users
Create a BusinessRole object, then a BusinessRoleDto object? Unless I'm misunderstanding which types below you want to combine?

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kwasi Denkyira

unread,
Nov 9, 2015, 9:57:21 AM11/9/15
to automapp...@googlegroups.com
Hi Jimmy
Thanks. I have got it working. Thanks for your response.

--
You received this message because you are subscribed to a topic in the Google Groups "AutoMapper-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/automapper-users/26R3fpn8UTQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to automapper-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages