Im very new to using parse and asp.net and mvc 5, right now im developing a application and right now iam doing a class in which i just call a method and creates a user, the problem is that I cant manage the exception thrown if a user already exists, it doesn't return from my model to my controller, how can i know in my controller if the account was created successfully to display different things in my view? right now i have this:

Model

public static class AppUser
{
    public static async Task Create(string name, string lastname, string username, string password, string email, string phone)
    {          
            var user = new ParseUser()
            {
                Username = username,
                Password = password,
                Email = email,
            };
            user["Name"] = name;
            user["LastName"] = lastname;
            user["Phone"] = phone;
            try 
            { 
                await user.SignUpAsync(); 
            }
            catch (ParseException) 
            {
                throw;
            }
    }

}

Controller

 public  ActionResult Index()
    {
        try { AppUser.Create("A name", "A lastname", "A user", "A password", "An email", "A phone"); }
        catch(ParseException)
        { //Do something but it never gets here}

        return View();
    }

Related posts

Recent Viewed