コード例 #1
0
        public ActionResult PosaljiSMS(PosaljiSMSVM vm)
        {
            var client = new Client(creds: new Nexmo.Api.Request.Credentials
            {
                ApiKey    = "ff373c2a",
                ApiSecret = "F1szqiBrqYj98WdJ"
            });

            foreach (var klijentId in vm.OdabraniKlijenti)
            {
                Korisnik klijent = db.Korisnik.Find(klijentId);

                string SadrzajPoruke = "Pozdrav, " + klijent.Ime + "!\n" + vm.Sadrzaj;

                var results = client.SMS.Send(new SMS.SMSRequest
                {
                    from = "+38762279893",
                    to   = klijent.BrojTelefona,
                    text = SadrzajPoruke
                });
            }

            UcitajVM(vm);


            return(View(vm));
        }
コード例 #2
0
        public ActionResult PosaljiSMS()
        {
            PosaljiSMSVM vm = new PosaljiSMSVM();

            UcitajVM(vm);

            return(View(vm));
        }
コード例 #3
0
 private void UcitajVM(PosaljiSMSVM vm)
 {
     vm.Klijenti = db.Korisnik.Include(x => x.Klijent).Where(x => x.Klijent.Id == x.KorisnikID)
                   .ToList();
 }