Beispiel #1
0
        public async Task <IHttpActionResult> Register(RegisterBindingModel model)
        {
            var company = new Business.Company();

            if (!ModelState.IsValid || !company.CheckById(model.CompanyId))
            {
                return(BadRequest(ModelState));
            }

            var user = new ApplicationUser()
            {
                UserName = model.Email, Email = model.Email, CompanyId = model.CompanyId
            };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return(GetErrorResult(result));
            }

            return(Ok());
        }
 public CompanyController()
 {
     _company = new Business.Company();
 }