public int DatabaseAdd(EcoPoint item) { HasTable(); try { return(_Database.Database.Insert(item)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
private async void BtnAddEcoPonto_Clicked(object sender, EventArgs e) { if (!Validate()) { await DisplayAlert("Ocorreu um erro!", "Revise suas informações, alguns campos não podem ser nulos.", "OK"); return; } try { Eco = new EcoPoint(NameEcoPontoEntry.Text, DescritionEcoPontoEntry.Text, Materials.SelectedItems.ToList(), new Address(CepEcoPontoEntry.Text, RuaEcoPontoEntry.Text, NumberEcoPontoEntry.Text, ComplementEcoPontoEntry.Text, BairroEcoPontoEntry.Text, CityEcoPontoEntry.Text, StateEcoPontoEntry.Text), new Phone(PhoneEcoPontoEntry.Text)); UserController.CurrentUser.EcoPoints.Add(Eco); CallbackStatus status = await EcoPointController.AddAPI(UserController.CurrentUser); await DisplayAlert($"{ status.CurrentStatus.CallbackStatusToText()}", status.CallbackMessage, "OK"); } catch { await DisplayAlert("Ocorreu um erro ao tentar adicionar novo ecoponto!", "Tente novamente mais tarde.", "OK"); } }
public async static Task <CallbackStatus> UpdateAPI(EcoPoint item) { return(await _DatabaseApi.UpdateDatabaseAPI(StaticsInfo.EcoPointURL, item)); }
public EcoPointScreen() { Eco = new EcoPoint(); InitializeComponent(); Init(); }
public void Put([FromBody] EcoPoint item) { DatabaseUpdate(item); }