Ejemplo n.º 1
0
        public int Post([FromBody] RegisterModel value)
        {
            Console.WriteLine(value.SecretAnswer + " " + value.SecretQuestion);
            User user = new User()
            {
                UserName       = value.UserName,
                PasswordHash   = value.PasswordHash,
                UserType       = UserType.Regular,
                CreationTime   = DateTime.Now,
                SecretQuestion = value.SecretQuestion,
                SecretAnswer   = value.SecretAnswer
            };

            int uid = _repo.AddUser(user);

            if (uid > 0)
            {
                Profile profile = new Profile()
                {
                    UserId        = uid,
                    FirstName     = value.FirstName,
                    LastName      = value.LastName,
                    Email         = value.EmailAddress,
                    Region        = value.Region,
                    PhoneNumber   = value.PhoneNumber,
                    ProfilePicUrl = value.ProfilePicUrl,
                };

                _repo.Add(profile);
            }

            return(uid);
        }