I was trying to map Customer data from List to Customer class the below way but not getting right result. the program is not giving any error but generating customer data with null values.
using AutoMapper;
List<Customer> oCust = new List<Customer>();
oCust.Add(new Customer { Name = "Rajan", Salary = 200, CountryCode = "GB" });
oCust.Add(new Customer { Name = "Ari", Salary = 200, CountryCode = "US" });
oCust.Add(new Customer { Name = "Dib", Salary = 200, CountryCode = "CA" });
var oCustomer = oCust.Where(x => x.CountryCode == "US").ToList(); ;
Mapper.CreateMap<List<Customer>, Customer>();
Customer viewModel = Mapper.Map<List<Customer>, Customer>(oCustomer);
I read some article on Automapper from this url http://www.codearsenal.net/2012/12/csharp-object-to-object-mapping-automapper.html#.VKqYbckpp68
Just guide me how to solve the above issue using Automapper
only.