private async void btnSacuvaj_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { request.Ime = txtIme.Text; request.Prezime = txtPrezime.Text; request.StrucnaSprema = txtstrucna.Text; request.BrojRadneKnjizice = txtBrRadneKnjizice.Text; if (_id.HasValue) { tehnicar = await _service.GetById <TehnicarVM>(_id); tehnicar.Ime = txtIme.Text; tehnicar.Prezime = txtPrezime.Text; tehnicar.BrojRadneKnjizice = txtBrRadneKnjizice.Text; tehnicar.StrucnaSprema = txtstrucna.Text; await _service.Update <TehnicarVM>(request); MessageBox.Show("Operacija uspješna"); } else { try { request.Password = txtPassword.Text; request.Email = txtEmail.Text; await _service.Insert <TehnicarVM>(request); MessageBox.Show("Operacija uspješna"); } catch { MessageBox.Show("Email ili Password format nije ispravan\n(Password mora imati slova, brojeve i znakove)"); } } } }
public TehnicarVM Update(int id, TehnicarVM tehnicar) { return(_userInterface.Update(tehnicar)); }