Esempio n. 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);
        }
 public void DeleteCustomerFromDb(EntityCustomers.Customer customerToDelete)
 {
     _dbContext.Remove(customerToDelete);
     _dbContext.SaveChanges();
 }
 public void AddCustomerToDb(EntityCustomers.Customer customerToAdd)
 {
     _dbContext.Add(customerToAdd);
     _dbContext.SaveChanges();
 }