예제 #1
0
        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);
        }
예제 #2
0
        public IHttpActionResult Register(RegisterBusinessBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _businessService.Register(model);
            return(Ok());
        }