Beispiel #1
0
        private async void btnDelete_click(object sender, RoutedEventArgs e)
        {
            Model.Trener trener = await _service.Delete(id);

            Application.Current.MainWindow = new TreneriPrikazWindow();
            Application.Current.MainWindow.Show();
            Close();
        }
        public TrenerMojiPodaciPage(int trenerId, Model.Trener t)
        {
            InitializeComponent();
            BindingContext = model = new TrenerMojiPodaciVM(trenerId, t);

            //model.LoadData(polaznikId, p);
            //Id = polaznikId;
        }
        private void ListView1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var id = ListView1.SelectedValue;

            Model.Trener trener = (Model.Trener)id;
            Application.Current.MainWindow = new TreneriUpdateWindow(trener.TrenerId);
            Application.Current.MainWindow.Show();
            Close();
        }
Beispiel #4
0
        public Model.Trener Delete(int id)
        {
            var trener = _context.Trener.Find(id);

            Model.Trener t = _mapper.Map <Model.Trener>(trener);
            if (trener != null)
            {
                _context.Trener.Remove(trener);
                _context.SaveChanges();
            }
            return(t);
        }
Beispiel #5
0
        public TrenerMojiPodaciVM(int trenerId, Model.Trener t)
        {
            LoadData(trenerId, t);
            InitCommand  = new Command(async() => await Init(trenerId));
            NazadCommand = new Command(() =>
            {
                Nazad(trenerId);
            });


            //IzmijeniCommand = new Command(() =>
            //{
            //    Izmijeni(userId, role, t);
            //});
        }
Beispiel #6
0
 public void LoadData(int trenerId, Model.Trener t)
 {
     _trenerID = trenerId;
     _ime      = t.Ime;
     _prezime  = t.Prezime;
     _mail     = t.Mail;
     _telefon  = t.Telefon;
     _adresa   = t.Adresa;
     _uloga    = t.Uloga;
     _username = t.KorisnickoIme;
     _jmbg     = t.JMBG;
     if (t.Slika != null)
     {
         Slika = ImageSource.FromStream(() => new MemoryStream(t.Slika));
     }
 }
Beispiel #7
0
        private async void LoadData(int?trenerId)
        {
            if (trenerId != null)
            {
                Model.Trener trener = await _service.GetById <Model.Trener>(trenerId);

                if (trener != null)
                {
                    textBoxIme.Text            = trener.Ime;
                    textBoxPrezime.Text        = trener.Prezime;
                    textBoxTelefon.Text        = trener.Telefon;
                    textBoxMail.Text           = trener.Mail;
                    textBoxAdresa.Text         = trener.Adresa;
                    textBoxOpis.Text           = trener.Opis;
                    dtmZaposlenja.SelectedDate = trener.DatumZaposlenja;
                }
            }
        }