public IActionResult Post([FromBody] User user)
        {
            bool IsValid(string emailAddress)
            {
                try
                {
                    MailAddress m = new MailAddress(emailAddress);
                    return(true);
                }
                catch (FormatException)
                {
                    return(false);
                }
            }

            if (user.key == "dupamaryny09182309810923890157091831937")
            {
                if (IsValid(user.email))
                {
                    try
                    {
                        UserAdder userAdder = new UserAdder();
                        userAdder.AddPermission(user.email);
                        return(StatusCode(200));
                    }
                    catch
                    {
                        return(StatusCode(500));
                    }
                }
                return(StatusCode(500));
            }
            else
            {
                return(StatusCode(500));
            }
        }
示例#2
0
 protected void CreateUserButton_Click(object sender, EventArgs e)
 {
     UserAdder.insertUser(UserName.Text, Password.Text, FirstName.Text, LastName.Text, Email.Text, DateOfBirth.Text, " ");
     Response.Redirect("Login.aspx", true);
 }