Beispiel #1
0
        public async void Register(View view)
        {
            ProgressDialog dialog = DialogHelper.CreateProgressDialog("Registering...", this);
            dialog.Show();

            RegisterRequest request = new RegisterRequest
            {
                FirstName = FindViewById<EditText>(Resource.Id.registerFirstName).Text,
                LastName = FindViewById<EditText>(Resource.Id.registerLastName).Text,
                StudentId = FindViewById<EditText>(Resource.Id.registerStudentId).Text,
                Password = FindViewById<EditText>(Resource.Id.registerPassword).Text
            };
            
            GenericResponse Response = await Services.Auth.Register(request);
            dialog.Hide();

            if (Response.Success)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.LightDialog);
                builder.SetTitle("Successfully Registered");
                builder.SetMessage("Please check your UTS email for instructions to confirm your account");
                builder.SetCancelable(false);
                builder.SetPositiveButton("OK", delegate { Finish(); });
                builder.Show();
            }
            else
            {
                DialogHelper.ShowDialog(this, Response.Message, Response.Title);
            }
        }
Beispiel #2
0
 public async Task<GenericResponse> Register(RegisterRequest request)
 {
     try
     {
         userTable.SetUser(new User { FirstName = request.FirstName, LastName = request.LastName, Email = request.Email, StudentId = request.StudentId });
         var response = await authClient.InvokeApiAsync<RegisterRequest, GenericResponse>("Registration", request);
         return ResponseHelper.Success();
     }
     catch (Exception ex)
     {
         return ResponseHelper.CreateErrorResponse("Registration Failure", ex);
     }
 }