Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Android.App;
- using Android.Content;
- using Android.OS;
- using Android.Runtime;
- using Android.Views;
- using Android.Widget;
- namespace Siman_Android
- {
- [Activity(Label = "PersonAddActivity")]
- public class PersonAddActivity : Activity
- {
- protected override void OnCreate(Bundle bundle)
- {
- base.OnCreate(bundle);
- Button btn = FindViewById<Button>(Resource.Id.btnadd);
- btn.Click += Btn_Click;
- }
- ServiceRefrence.Service1 myService = new ServiceRefrence.Service1();
- private void Btn_Click(object sender, EventArgs e)
- {
- myService.Url=("http://localhost:13294/Service1.svc");
- EditText txtname = FindViewById<EditText>(Resource.Id.txtname);
- EditText txtfamily = FindViewById<EditText>(Resource.Id.txtfamily);
- myService.GetPersonAsync(txtname.Text, txtfamily.Text);
- }
- }
- }
- public bool GetPerson(string FirstName, string LastName)
- {
- try
- {
- PersonName pr = new PersonName()
- {
- Family = LastName,
- Name = FirstName
- };
- db.PersonNames.Add(pr);
- db.SaveChanges();
- return true;
- }
- catch (Exception)
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement