public ActionResult ResimYükle(HttpPostedFileBase file, int oid, string otel_oda)
        {
            if (file != null)
            {
                string pic = System.IO.Path.GetFileName(file.FileName);
                string path;
                if (otel_oda == "oda")
                {
                    path = System.IO.Path.Combine(
                        Server.MapPath("~/Content/assets/images/required/Fotolar/OdaFotolar"), pic);
                    file.SaveAs(path);
                    OdaFoto o = new OdaFoto();
                    o.OdaID = oid;
                    o.Link  = "/Content/assets/images/required/Fotolar/OdaFotolar/" + pic;
                    m.OdaFoto.Add(o);
                    m.SaveChanges();
                }
                else
                {
                    path = System.IO.Path.Combine(
                        Server.MapPath("~/Content/assets/images/required/Fotolar/OtelFotolar"), pic);

                    file.SaveAs(path);
                    OtelFoto o = new OtelFoto();
                    o.OtelID = oid;
                    o.Link   = "/Content/assets/images/required/Fotolar/OtelFotolar/" + pic;
                    m.OtelFoto.Add(o);
                    m.SaveChanges();
                }

                // file is uploaded


                // save the image path path to the database or you can send image
                // directly to database
                // in-case if you want to store byte[] ie. for DB
                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                }
            }
            if (otel_oda == "oda")
            {
                return(RedirectToAction("OdaGüncelleForm", "OtelYöneticisi", new { id = oid }));
            }
            else
            {
                return(RedirectToAction("Fotolar", "OtelYöneticisi"));
            }
        }
        public ActionResult Görüntüle(int id, int kisiSayı, string giriş, string çıkış)

        {
            SonGörüntülenenEkle(id);
            ViewBag.girisTarih = giriş;
            ViewBag.cıkısTarih = çıkış;
            ViewBag.kisi       = kisiSayı;
            ViewBag.tumOdalar  = false;
            ViewBag.otel       = m.Otel.Where(x => x.ID == id).FirstOrDefault();
            List <Oda> odalar = m.Database.SqlQuery <Oda>("select * from Oda as o where OtelID=" + id + " and Kapasite>=" + kisiSayı + " and not exists (select * from Rezervasyon as r where r.OdaID=o.ID and ((r.GirişTarih>'" + giriş + "'  and r.GirişTarih<'" + çıkış + "' ) or (r.ÇıkışTarih<'" + çıkış + "'  and r.ÇıkışTarih>'" + giriş + "' ) or (r.GirişTarih<='" + giriş + "' )and r.ÇıkışTarih>='" + çıkış + "' ) ) order by Kapasite asc").ToList <Oda>();
            var        dict   = new Dictionary <Oda, string>();

            foreach (Oda o in odalar)
            {
                int     oid = o.ID;
                OdaFoto f   = m.OdaFoto.Where(x => x.OdaID == oid).FirstOrDefault();
                if (f != null)
                {
                    dict[o] = f.Link;
                }
                else
                {
                    dict[o] = "/Content/assets/images/required/otelim_logo.png";
                }
            }
            OtelViewModel model = new OtelViewModel();

            model.odalar   = dict;
            model.fotolar  = m.OtelFoto.Where(x => x.OtelID == id).ToList();
            model.yorumlar = Yorumlar(id);

            int kid = Convert.ToInt32(Session["id"]);

            ViewBag.user = m.Kullanıcı.Where(x => x.ID == kid).FirstOrDefault();



            ViewBag.ps = m.OtelPuanlandırma.Where(x => x.OtelID == id).ToList().Count;



            return(View(model));
        }
        public ActionResult TumOdalar(int id)
        {
            Boolean fav = FavoriKontrol(id);

            ViewBag.fav = fav;

            int kid             = Convert.ToInt32(Session["id"]);
            OtelPuanlandırma op = m.OtelPuanlandırma.Where(x => x.KullanıcıID == kid && x.OtelID == id).FirstOrDefault();

            if (op != null)
            {
                ViewBag.userrate = op.Puan;
            }
            else
            {
                ViewBag.userrate = 1;
            }

            SonGörüntülenenEkle(id);

            ViewBag.tumOdalar = true;
            ViewBag.otel      = m.Otel.Where(x => x.ID == id).FirstOrDefault();
            List <Oda> odalar = m.Oda.Where(x => x.OtelID == id).ToList();
            var        dict   = new Dictionary <Oda, string>();

            foreach (Oda o in odalar)
            {
                int     oid = o.ID;
                OdaFoto f   = m.OdaFoto.Where(x => x.OdaID == oid).FirstOrDefault();
                if (f != null)
                {
                    dict[o] = f.Link;
                }
                else
                {
                    dict[o] = "/Content/assets/images/required/otelim_logo.png";
                }
            }
            OtelViewModel model = new OtelViewModel();

            model.odalar   = dict;
            model.fotolar  = m.OtelFoto.Where(x => x.OtelID == id).ToList();
            model.yorumlar = Yorumlar(id);

            ViewBag.user = m.Kullanıcı.Where(x => x.ID == kid).FirstOrDefault();


            ViewBag.ps = m.OtelPuanlandırma.Where(x => x.OtelID == id).ToList().Count;


            if (m.OtelPuanlandırma.Where(x => x.OtelID == id && x.KullanıcıID == kid).FirstOrDefault() == null)
            {
                ViewBag.pcheck = 0;
            }
            else
            {
                ViewBag.pcheck = 1;
            }

            return(View("Görüntüle", model));
        }