Example #1
0
 /// <summary>
 /// Method that converts DB customers to business logic customers and vice versa
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 public BusinessLogic.Customer ParseCustomer(Entities.Customer c)
 {
     return(new BusinessLogic.Customer()
     {
         City = c.City,
         FirstName = c.FirstName,
         LastName = c.LastName,
         Street = c.Street,
         State = (States)Enum.Parse(typeof(States), c.State, true),
         Zipcode = int.Parse(c.ZipCode),
         CustID = c.CustId
     });
 }
Example #2
0
 /// <summary>
 /// A method that convert DataAccess.Entities.Customer => Library.Customer
 /// </summary>
 /// <param name="customer"> a DataAcess.Entities.Customr that will be used to convert to Library.Customer </param>
 /// <returns> return a converted Library.Customer object </returns>
 public static Project1.Library.Modals.Customer Map(Project1.DataAccess.Entities.Customer customer)
 {
     return(new Library.Modals.Customer
     {
         CustomerId = customer.CustomerId,
         FirstName = customer.FirstName,
         LastName = customer.LastName,
         Address = new Library.Modals.Address
         {
             X = customer.X,
             Y = customer.Y,
         },
         OrderHistory = Mapper.Map(customer.OrderHistory) ?? new List <Order>()
     });
 }