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 System.Threading.Tasks;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace OrganizeSe
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class NewIngPage : ContentPage
- {
- public NewIngPage ()
- {
- InitializeComponent ();
- }
- private void Button_Clicked(object sender, EventArgs e)
- {
- Ingredientes ing = new Ingredientes()
- {
- Nome = nameEntry.Text,
- Preco = precoEntry.Text,
- Qnt = qntEntry.Text
- };
- using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH))
- {
- conn.CreateTable<Ingredientes>();
- var numberOfRows = conn.Insert(ing);
- if (numberOfRows>0)
- DisplayAlert("Salvo!", "O ingrediente foi salvo com sucesso.", "Ok");
- else
- DisplayAlert("Falha!", "O ingrediente NÃO foi salvo.", "Ok");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement