public async Task <IActionResult> PrikaziNovost(int novostId) { var resNovost = await _novostiService.GetById(novostId); Model.Novosti novost = null; if (resNovost.IsSuccessStatusCode) { novost = JsonConvert.DeserializeObject <Model.Novosti>(resNovost.Content.ReadAsStringAsync().Result); var resNotif = await _notifikacijeService.Get(new NotifikacijeSearchRequest() { NovostId = novostId }); if (resNotif.IsSuccessStatusCode) { var notifikacija = JsonConvert.DeserializeObject <List <Model.Notifikacije> >(resNotif.Content.ReadAsStringAsync().Result); await oznaciProcitano(notifikacija[0].Id); } } return(View(novost)); }
public NovostiDetaljiPage() { InitializeComponent(); var item = new Model.Novosti { Naziv = "Item 1", Opis = "This is an item description.", Datum = DateTime.Now, Slika = null }; viewModel = new NovostiDetaljiViewModel(item); BindingContext = viewModel; }
private async void btnSacuvaj_Click(object sender, EventArgs e) { var korisniklist = await _korisniciService.Get <List <Model.Korisnici> >(new KorisniciSearchRequest() { KorisnickoIme = APIService.Username }); var korisnik = korisniklist.Where(x => x.KorisnickoIme == APIService.Username).FirstOrDefault(); if (ValidateChildren()) { var request = new NovostiUpsertRequest() { Datum = DateTime.Now, Naziv = txtNaziv.Text, Opis = txtOpis.Text, KorisnikId = korisnik.KorisnikId }; if (txtSlika.Text != string.Empty)//Slika { var file = File.ReadAllBytes(txtSlika.Text); request.Slika = file; } else { request.Slika = slikaTemp; } Model.Novosti entity = null; if (_id.HasValue) { entity = await _novostiService.Update <Model.Novosti>(_id.Value, request); } else { entity = await _novostiService.Insert <Model.Novosti>(request); } if (entity != null) { MessageBox.Show("Uspješno izvršeno"); } this.Close(); } }
public NovostiDetaljiViewModel(Model.Novosti item = null) { Title = "Pregled novosti"; Item = item; InitCommand = new Command(() => Init()); }
public DetaljiNovostiViewModel(Model.Novosti novost = null) { n = novost; UcitajDetaljeCommand = new Command(async() => await UcitajDetalje()); }
public DetaljiNovostiPage(Model.Novosti novost) { InitializeComponent(); BindingContext = model = new DetaljiNovostiViewModel(novost); }