public static List <CustomerEntity> GetCustomers() { List <CustomerEntity> customers = new List <Entity.CustomerEntity>(); using (fitnessEntities dbe = new fitnessEntities()) { CustomerEntity customerEntity; var customerList = dbe.customers.ToList(); foreach (var customer in customerList) { customerEntity = new Entity.CustomerEntity(); customerEntity.customer_id = customer.customer_id; customerEntity.customer_fullname = customer.customer_fullname; customerEntity.customer_address = customer.customer_address; customerEntity.customer_phone = customer.customer_phone; customerEntity.customer_photo = customer.customer_photo; customerEntity.customer_gender = customer.customer_gender; customerEntity.customer_joindate = customer.customer_joindate; customerEntity.trainer_name = customer.trainer_id; customerEntity.plan_name = customer.plan_id; customerEntity.customer_username = customer.customer_username; customerEntity.customer_password = customer.customer_password; customers.Add(customerEntity); } } return(customers); }
public static CustomerEntity DetailCustomer(string Id) { CustomerEntity customerEntity = new Entity.CustomerEntity(); using (fitnessEntities dbe = new fitnessEntities()) { customer customer = dbe.customers.Where(o => o.customer_id.Equals(Id)).SingleOrDefault(); customerEntity.customer_id = customer.customer_id; customerEntity.customer_fullname = customer.customer_fullname; customerEntity.customer_address = customer.customer_address; customerEntity.customer_phone = customer.customer_phone; customerEntity.customer_photo = customer.customer_photo; customerEntity.customer_gender = customer.customer_gender; customerEntity.customer_joindate = customer.customer_joindate; customerEntity.trainer_id = customer.trainer_id; customerEntity.plan_id = customer.plan_id; customerEntity.customer_username = customer.customer_username; customerEntity.customer_password = customer.customer_password; } return(customerEntity); }