private async void RegistracijaButton_Clicked(object sender, EventArgs e) { ValidatingControl[] arr; arr = new ValidatingControl[] { new ValidatingControl(imeInput, "Ime ne smije biti prazno!"), new ValidatingControl(prezimeInput, "Prezime ne smije biti prazno!"), new ValidatingControl(emailInput, "Email mora biti u validnom formatu!"), new ValidatingControl(korisnickoImeInput, "Korisničko ime ne smije biti prazno!"), new ValidatingControl(lozinkaInput, "Lozinka ne smije biti prazna!") }; var errMsgs = ValidatorHelper.Validacija(arr, PageValidating.Registracija); if (string.IsNullOrEmpty(errMsgs)) { try { loadingLabel.IsVisible = true; var kupac = new Model.Requests.KupciUpsertRequest() { Ime = imeInput.Text, Prezime = prezimeInput.Text, Email = emailInput.Text, KorisnickoIme = korisnickoImeInput.Text, Password = lozinkaInput.Text, Status = true, DatumRegistracije = DateTime.Now }; var entity = await _kupciService.Insert <Model.Kupci>(kupac); loadingLabel.IsVisible = false; if (entity != null) { await DisplayAlert("Uspjeh", "Uspješno ste se registrovali!", "OK"); await this.Navigation.PopAsync(); } } catch (Exception ex) { await DisplayAlert("Greška", ex.Message, "OK"); } } else { await DisplayAlert("Greška", errMsgs, "OK"); } }
private async void SnimiButton_Clicked(object sender, EventArgs e) { ValidatingControl[] arr; arr = new ValidatingControl[] { new ValidatingControl(imeInput, "Ime ne smije biti prazno!"), new ValidatingControl(prezimeInput, "Prezime ne smije biti prazno!"), new ValidatingControl(emailInput, "Email mora biti u validnom formatu!"), new ValidatingControl(korisnickoImeInput, "Korisničko ime ne smije biti prazno!"), new ValidatingControl(lozinkaInput, "Lozinka ne smije biti prazna!") }; var errMsgs = ValidatorHelper.Validacija(arr, PageValidating.Registracija); if (string.IsNullOrEmpty(errMsgs)) { try { var kupac = new Model.Requests.KupciUpsertRequest() { Ime = imeInput.Text, Prezime = prezimeInput.Text, Email = emailInput.Text, KorisnickoIme = Global.prijavljeniKupac.KorisnickoIme, Password = lozinkaInput.Text, Status = Global.prijavljeniKupac.Status, DatumRegistracije = Global.prijavljeniKupac.DatumRegistracije }; var entity = await _kupciService.Update <Model.Kupci>(Global.prijavljeniKupac.KupacId, kupac); if (entity != null) { Global.prijavljeniKupac = entity; await DisplayAlert("Uspjeh", "Uspješno ste se izmijenili podatke!", "OK"); await this.Navigation.PushModalAsync(new MyPage()); } } catch (Exception ex) { await DisplayAlert("Greška", ex.Message, "OK"); } } else { await DisplayAlert("Greška", errMsgs, "OK"); } }
public Model.Kupci Insert(Model.Requests.KupciUpsertRequest request) { return(_service.Insert(request)); }
public Model.Kupci Update(int id, Model.Requests.KupciUpsertRequest request) { return(_service.Update(id, request)); }