예제 #1
0
        // in goes an entity model and out comes a service model
        public static ServiceCustomers.Customer SerialiseCustomer(EntityCustomers.Customer entityCustomer)
        {
            var serviceCustomer = new ServiceCustomers.Customer()
            {
                Id             = entityCustomer.Id,
                GivenName      = entityCustomer.GivenName,
                Surname        = entityCustomer.Surname,
                PrimaryAddress = SerialiseCustomerAddress(entityCustomer.PrimaryAddress),
                CreatedOn      = entityCustomer.CreatedOn,
                UpdatedOn      = entityCustomer.UpdatedOn
            };

            return(serviceCustomer);
        }
예제 #2
0
 public void DeleteCustomerFromDb(EntityCustomers.Customer customerToDelete)
 {
     _dbContext.Remove(customerToDelete);
     _dbContext.SaveChanges();
 }
예제 #3
0
 public void AddCustomerToDb(EntityCustomers.Customer customerToAdd)
 {
     _dbContext.Add(customerToAdd);
     _dbContext.SaveChanges();
 }