Dismissing the modal view controller after success and showing a dialog for failure