public void Register(RegisterBusinessBindingModel model) { var business = new BusinessUser { UserName = model.Email, Email = model.Email, CompanyName = model.CompanyName, ServiceCategory = model.ServiceCategory, Description = model.Description, Orders = new List<Order>(), UserAddresses = new List<UserAddress>() { new UserAddress() { FirstName = model.PrimaryAddress.FirstName, LastName = model.PrimaryAddress.LastName, Phone = model.PrimaryAddress.Phone, AddressLine1 = model.PrimaryAddress.AddressLine1, AddressLine2 = model.PrimaryAddress.AddressLine2, City = model.PrimaryAddress.City, State = model.PrimaryAddress.State, Zipcode = model.PrimaryAddress.Zipcode } } }; _userManager.Create(business, model.Password); }
private BusinessUserDTO Map(BusinessUser dbCustomer) { return dbCustomer != null ? new BusinessUserDTO() { Id = dbCustomer.Id, UserName = dbCustomer.UserName, CompanyName = dbCustomer.CompanyName, ServiceCategory = dbCustomer.ServiceCategory, Description = dbCustomer.Description, Orders = (from order in dbCustomer.Orders select new OrderDTO() { Id = order.Id, ServiceName = order.ServiceName, OrderDate = order.OrderDate, CompletionDate = order.CompletionDate, Price = order.Price, ServiceQuality = order.ServiceQuality, IsApproved = order.IsApproved, IsCompleted = order.IsCompleted }).ToList(), UserAddresses = (from useraddress in dbCustomer.UserAddresses select new UserAddressDTO() { FirstName = useraddress.FirstName, LastName = useraddress.LastName, Phone = useraddress.Phone, AddressLine1 = useraddress.AddressLine1, AddressLine2 = useraddress.AddressLine2, City = useraddress.City, State = useraddress.State, Zipcode = useraddress.Zipcode }).ToList() } : null; }