Beispiel #1
0
        async Task Login()
        {
            IsBusy = true;

            try
            {
                KupciVM kupac = await _service.Authenticiraj <KupciVM>(Username, Password);


                if (kupac != null)
                {
                    Global.PrijavljeniKupac = kupac;

                    await Application.Current.MainPage.DisplayAlert("Uspjeh", "Dobrodosli " + kupac.Ime + " " + kupac.Prezime, "OK");

                    Application.Current.MainPage = new MainPage();
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Greska", "Pogresno unesen username ili password", "OK");
                }
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Greska", ex.Message, "OK");
            }
        }
Beispiel #2
0
        public KupciVM GetById(int id)
        {
            var entity = _context.Kupci.Find(id);

            var brojRezervacija = _context.Rezervacije.Where(w => w.KupacId == id).Count();

            KupciVM kupciVM = _mapper.Map <KupciVM>(entity);

            kupciVM.BrojRezervacija = brojRezervacija;

            return(kupciVM);
        }
Beispiel #3
0
        public async Task Update()
        {
            KupciUpdateRequest updateRequest = new KupciUpdateRequest();

            KupciVM kupciVM = new KupciVM();

            updateRequest.Email   = UrediEmail;
            updateRequest.Ime     = UrediIme;
            updateRequest.Prezime = UrediPrezime;

            kupciVM = await _kupci.Update <KupciVM>(Global.PrijavljeniKupac.KupacId, updateRequest);

            if (kupciVM != null)
            {
                ProfilUpdatean = true;
            }
        }
Beispiel #4
0
        public KupciVM Update(int id, KupciUpdateRequest request)
        {
            var kupacUpdate = _context.Kupci.Find(id);

            KupciVM kupciVM = new KupciVM();

            if (kupacUpdate != null && request != null)
            {
                kupacUpdate.Ime     = request.Ime;
                kupacUpdate.Prezime = request.Prezime;
                kupacUpdate.Email   = request.Email;

                _context.SaveChanges();
            }

            kupciVM = _mapper.Map <KupciVM>(kupacUpdate);

            return(kupciVM);
        }