Ejemplo n.º 1
0
 public int SaveUserDevice(userDevice item)
 {
     if (item.id != 0)
     {
         database.Update(item);
         return(item.id);
     }
     else
     {
         return(database.Insert(item));
     }
 }
Ejemplo n.º 2
0
        private void Save_Clicked(object sender, EventArgs e)
        {
            var device = new device();

            device.name     = name.Text;
            device.idType   = type.SelectedIndex + 1;
            device.isEnable = true;
            App.database.SaveDevice(device);
            var devicefinal = App.database.GetDevice().ToList().LastOrDefault();
            var userDevice  = new userDevice();

            userDevice.idDevice = devicefinal.id;
            userDevice.idUser   = MainPage.user.id;
            App.database.SaveUserDevice(userDevice);
            Navigation.PopAsync();
        }