コード例 #1
0
        public IHttpActionResult Register(RegisterCustomerBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _customerService.Register(model);
            return Ok();
        }
コード例 #2
0
 public void Register(RegisterCustomerBindingModel model)
 {
     var customer = new CustomerUser
     {
         UserName = model.Email,
         Email = model.Email,
         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(customer, model.Password);
 }