public ActionResult OtelGüncelleForm() { int yid = Convert.ToInt32(Session["yid"]); OtelYöneticisi o = m.OtelYöneticisi.Where(x => x.ID == yid).FirstOrDefault(); ViewBag.oy = o; Otel otel = m.Otel.Where(x => x.YöneticiID == yid).FirstOrDefault(); return(View(otel)); }
public ActionResult OtelGüncelleForm(int otelID) { Otel otel = m.Otel.Where(x => x.ID == otelID).FirstOrDefault(); int? yid = otel.YöneticiID; OtelYöneticisi y = m.OtelYöneticisi.Where(x => x.ID == yid).FirstOrDefault(); ViewBag.yonetici = y; ViewBag.otel = otel; return(View()); }
public ActionResult YöneticiGüncelle(string Ad, string Soyad, string email, string password) { int yid = Convert.ToInt32(Session["yid"]); OtelYöneticisi o = m.OtelYöneticisi.Where(x => x.ID == yid).FirstOrDefault(); o.Ad = Ad; o.Soyad = Soyad; o.Mail = email; o.Şifre = password; Session["name"] = Ad; m.SaveChanges(); return(RedirectToAction("OtelGüncelleForm", "OtelYöneticisi")); }
public ActionResult Rezervasyonlar() { int id = Convert.ToInt32(Session["yid"]); OtelYöneticisi y = m.OtelYöneticisi.Where(x => x.ID == id).FirstOrDefault(); string q = "select * from Rezervasyon where OdaID in (select ID from Oda where OtelID=(select OtelID from OtelYöneticisi where ID=@yid)) and ÇıkışTarih< GETDATE()"; List <Rezervasyon> l1 = m.Database.SqlQuery <Rezervasyon>(q, new SqlParameter("yid", id)).ToList(); string q2 = "select * from Rezervasyon where OdaID in (select ID from Oda where OtelID=(select OtelID from OtelYöneticisi where ID=@yid)) and ÇıkışTarih> GETDATE()"; List <Rezervasyon> l2 = m.Database.SqlQuery <Rezervasyon>(q2, new SqlParameter("yid", id)).ToList(); RezervasyonViewModel model = new RezervasyonViewModel(); model.past = l1; model.future = l2; return(View(model)); }
public ActionResult OtelEkle(string name, int htype, int stars, string city, string YMail, string ad, string soyad) { Otel o = new Otel(); o.OtelAdı = name; o.OtelTürüID = htype; o.YıldızSayısı = stars; o.Şehir = city; m.Otel.Add(o); m.SaveChanges(); OtelYöneticisi y = new OtelYöneticisi(); y.Mail = YMail; y.Ad = ad; y.Soyad = soyad; y.OtelID = o.ID; m.OtelYöneticisi.Add(y); m.SaveChanges(); o.YöneticiID = y.ID; m.SaveChanges(); return(RedirectToAction("../Admin/OtelleriGörüntüle")); }
public ActionResult Giris(string mail, string password, string url) { Session.RemoveAll(); Kullanıcı k = m.Kullanıcı.Where(x => x.Mail == mail).FirstOrDefault(); OtelYöneticisi y = m.OtelYöneticisi.Where(x => x.Mail == mail).FirstOrDefault(); Admin a = m.Admin.Where(x => x.Mail == mail).FirstOrDefault(); if (k != null && k.Sifre == password) { Session["name"] = k.Ad; Session["id"] = k.ID; if (url == "") { return(RedirectToAction("../Home/Index")); } else { return(Redirect(url)); } } else if (y != null && y.Şifre == password) { Session["name"] = y.Ad; Session["yid"] = y.ID; return(RedirectToAction("../OtelYöneticisi/Index")); } else if (a != null && a.Şifre == password) { Session["name"] = a.Ad; Session["aid"] = a.ID; return(RedirectToAction("../Admin/Index")); } else { Session["loginfail"] = true; return(RedirectToAction("../Login/Index")); } }
public ActionResult OtelGüncelle(int otelid, int?yid, string name, int htype, int stars, string city, string YMail, string ad, string soyad) { Otel o = m.Otel.Where(x => x.ID == otelid).FirstOrDefault(); o.OtelAdı = name; o.OtelTürüID = htype; o.YıldızSayısı = stars; o.Şehir = city; OtelYöneticisi y = new OtelYöneticisi(); if (yid != null) { y = m.OtelYöneticisi.Where(x => x.ID == yid).FirstOrDefault(); if (y != null) { y.Mail = YMail; y.Ad = ad; y.Soyad = soyad; } } m.SaveChanges(); return(RedirectToAction("../Admin/OtelleriGörüntüle")); }