public async Task <ActionResult> Register(KorisnikAzure model) //KorisnikAzure
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.ime, Email = model.email
                };
                var result = await UserManager.CreateAsync(user, model.sifra);

                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
                    var kor = new KorisnikAzuresController();
                    kor.ControllerContext = ControllerContext;
                    kor.Create(model);
                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }


            // If we got this far, something failed, redisplay form
            // return View(model);
            //wtf heheheh
            return(View("~/Views/KorisnikAzures/Create.cshtml"));
        }
Exemple #2
0
        private async void zavrsiRegistraciju(object parametar)
        {
            using (var DB = new PlanBDbContext())
            {
                if (rVerifikacijskiKod != VerifikacijskiKod)
                {
                    Poruka = new MessageDialog("Uneseni verifikacijski kod nije tačan.");
                    await Poruka.ShowAsync();

                    return;
                }

                KorisnikAzure obj = new KorisnikAzure();
                obj.ime           = rIme;
                obj.prezime       = rPrezime;
                obj.korisnickoIme = rKorisnickoIme;
                obj.lozinka       = rLozinka;
                obj.email         = rEmail;
                obj.datumRodjenja = rDatumRodjenja;
                IMobileServiceTable <KorisnikAzure> azureKorisnik = App.MobileService.GetTable <KorisnikAzure>();
                List <KorisnikAzure> listaKorisnika = await azureKorisnik.Where(x => x.id != "").ToListAsync();

                obj.redniBroj = listaKorisnika.Count + 1;
                await userTableObj.InsertAsync(obj);

                Korisnik korisnik = new Korisnik(0, rIme, rPrezime, rKorisnickoIme, rLozinka, rDatumRodjenja, rEmail);
                korisnik.idAzure = obj.id;
                DB.Korisnici.Add(korisnik);
                DB.SaveChanges();

                Poruka = new MessageDialog("Uspješno kreiran račun.");
                VerifikacijaPanelVisiblity = false;
                await Poruka.ShowAsync();
            }
        }
        public ActionResult DeleteConfirmed(string id)
        {
            KorisnikAzure korisnikAzure = db.KorisnikAzures.Find(id);

            db.KorisnikAzures.Remove(korisnikAzure);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,createdAt,updatedAt,version,deleted,ime,prezime,jmbg,datumRodjenja,telefon,email,sifra,idKartice")] KorisnikAzure korisnikAzure)
 {
     if (ModelState.IsValid)
     {
         db.Entry(korisnikAzure).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(korisnikAzure));
 }
        // GET: KorisnikAzures/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KorisnikAzure korisnikAzure = db.KorisnikAzures.Find(id);

            if (korisnikAzure == null)
            {
                return(HttpNotFound());
            }
            return(View(korisnikAzure));
        }
        public ActionResult Create([Bind(Include = "id,ime,prezime,jmbg,datumRodjenja,telefon,email,sifra,idKartice")] KorisnikAzure korisnikAzure)
        {//id,createdAt,updatedAt,version,deleted,
            var    zaId = db.KorisnikAzures.ToList();
            String id   = zaId.Count.ToString();

            korisnikAzure.id = id;


            if (ModelState.IsValid)
            {
                db.KorisnikAzures.Add(korisnikAzure);
                db.SaveChanges();

                return(RedirectToAction("Index", "Home"));
            }


            return(View(korisnikAzure));
        }