public ActionResult Register(GOST gost) { var userWithSameEmail = db.GOSTs.Where(m => m.EMAIL_GOSTA == gost.EMAIL_GOSTA).SingleOrDefault(); if (ModelState.IsValid) { if (userWithSameEmail == null) { if (gost.PASS_GOSTA != gost.CPASS_GOSTA) { return(View(gost)); } else { gost.MAIL_POTVRA = false; } System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage( new System.Net.Mail.MailAddress("*****@*****.**", "Registracija na web"), new System.Net.Mail.MailAddress(gost.EMAIL_GOSTA)); m.Subject = "Povrda e-mail adrese"; m.Body = string.Format("Postovani {0},<BR/>Hvala vam na registraciji, kliknite na link ispod da potvrdite: <a href=\"{1}\" title=\"User Email Confirm\">{1}</a>", gost.EMAIL_GOSTA, Url.Action("ConfirmEmail", "Account", new { Token = gost.EMAIL_GOSTA }, Request.Url.Scheme)); m.IsBodyHtml = true; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587); smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "al255593"); smtp.EnableSsl = true; ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(m); db.GOSTs.Add(gost); db.SaveChanges(); return(RedirectToAction("CekajKonfirmaciju")); } else { ViewBag.Message = "Postoji korisnik sa ovom adresom!"; return(View(gost)); } } return(View(gost)); }
public ActionResult DodajConfirmed(string ime, string prezime) { GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single(); string posiljalac = TempData["idGosta"].ToString(); PRIJATELJI pr = new PRIJATELJI(); pr.EMAIL_GOSTA1 = posiljalac; pr.EMAIL_GOSTA = gost.EMAIL_GOSTA; pr.PRIJATELJI_OD = System.DateTime.Now; db.PRIJATELJIs.Add(pr); db.SaveChanges(); return(RedirectToAction("Profil")); }
public ActionResult CreateRestoran(RESTORAN restoran) { var restarauntWithSameID = db.RESTORANs.Where(m => m.NAZIV_RESTORANA == restoran.NAZIV_RESTORANA).SingleOrDefault(); if (ModelState.IsValid) { if (restarauntWithSameID == null) { restoran.BROJ_KOLONA = 1; db.RESTORANs.Add(restoran); for (int i = 1; i <= restoran.BROJ_STOLOVA; i++) { STO sto = new STO(); sto.ID_STOLA = i.ToString(); sto.BR_STOLICA = 4; sto.ID_RESTORANA = restoran.ID_RESTORANA; db.STOes.Add(sto); db.SaveChanges(); } db.SaveChanges(); return(RedirectToAction("ProfilAdmina")); } else { ViewBag.Message = "Postoji restoran sa ovim nazivom!"; return(View(restoran)); } } return(View()); }
public ActionResult Edit(MENADZER men) { if (ModelState.IsValid) { db.Entry(men).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ProfilMenadzera")); } return(View(men)); }
public ActionResult RezervisiRestoran3(string id) { String idgosta = Session["idGosta"].ToString(); // var ubaciRezervaciju= from x in db.REZERVACIJAs REZERVACIJA rez = new REZERVACIJA(); rez.EMAIL_GOSTA = idgosta; //rez.ID_STOLA = idStola; rez.DATUM = (System.DateTime)TempData["datum"]; rez.VREME_DOLASKA = (System.DateTime)TempData["dolazak"]; rez.VREME_ODLASKA = (System.DateTime)TempData["odlazak"]; rez.ID_RESTORANA = (String)TempData["r"]; using (var db = new aco4Entities()) { { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { db.napuni_rezervacije(99, rez.EMAIL_GOSTA, rez.ID_RESTORANA, id, rez.DATUM, rez.VREME_DOLASKA, rez.VREME_ODLASKA); db.SaveChanges(); dbContextTransaction.Commit(); } catch (Exception) { dbContextTransaction.Rollback(); return(View()); } } } } List <string> lista = TempData["checkboxovi"] as List <String>; // lista.Remove(id); TempData["rez"] = rez; return(RedirectToAction("PozoviPrijatelje")); }