public async Task<IHttpActionResult> Register(RegisterModel userModel)
        {
            if (!ModelState.IsValid)
            {
                Log.Debug("Register failed with username: "******"User:  "******" already registered.");
                return BadRequest();
            }

            UserInfos info = new UserInfos();
            info.firstname = userModel.Firstname;
            info.lastname = userModel.Lastname;
            info.User_FK = result.Id;
            await db.SaveChangesAsync();
            db.UserInfos.Add(info);
            await db.SaveChangesAsync();

            Log.Debug("Register successful with username: " + userModel.email);

            return Ok();
        }
 public RegisterModel CreateRegisterModel(String firstname, String lastname,
                                          String email, String password)
 {
     RegisterModel model = new RegisterModel();
     model.Firstname = firstname;
     model.Lastname = lastname;
     model.email = email;
     model.Password = password;
     return model;
 }
 public void Register_ShouldFailBecauseOfInvalidUsername()
 {
     RegisterModel registerUser = new RegisterModel();
     registerUser.Firstname = "swasdg";
     registerUser.Lastname = "lastname";
     registerUser.email = "*****@*****.**";
     registerUser.Password = "******";
     //RegisterModel registerUser = helper.CreateRegisterModel(null, "lastname", "*****@*****.**", "Test12§$");
     var response = new PreliminaryStudyController().GetProjectDescription(49);
     Console.WriteLine(response);
     Assert.AreEqual(response, HttpStatusCode.OK);
     
 }
        public async Task<IdentityUser> RegisterUser(RegisterModel userModel)
        {
            IdentityUser user = new IdentityUser
            {
                UserName = userModel.email
            };
           
            var result = await _userManager.CreateAsync(user, userModel.Password);

            if (result.Succeeded == false)
                return null;

            return user;
        }