Exemple #1
0
        public bool UpdateProduct(ref KasurEmpukBDO kasurBDO, ref string message)
        {
            message = "Room updated successfully";
            bool ret = true;

            using (var KEEntities = new HotelKasurEmpukEntities())
            {
                var   kamar_ID  = kasurBDO.Kamar_ID;
                Kamar kamarInDB = (from p in KEEntities.Kamar
                                   where p.kamarID == kamar_ID
                                   select p).FirstOrDefault();
                if (kamarInDB == null)
                {
                    throw new Exception("No room(s) found with ID " + kasurBDO.Kamar_ID);
                }

                KEEntities.Kamar.Remove(kamarInDB);
                kamarInDB.Harga  = kasurBDO.Harga;
                kamarInDB.Jenis  = kasurBDO.Jenis;
                kamarInDB.Jumlah = kasurBDO.Jumlah;
                KEEntities.Entry(kamarInDB).State = System.Data.Entity.EntityState.Modified;
                KEEntities.SaveChanges();
            }
            return(ret);
        }
Exemple #2
0
        public void InsertProduct(KasurEmpukBDO mawar)
        {
            Kamar penerbangan = new Kamar()
            {
                kamarID = mawar.Kamar_ID,
                Jumlah  = (int)mawar.Jumlah,
                Harga   = (int)mawar.Harga,
                Jenis   = mawar.Jenis
            };

            /*Console.WriteLine(mawar.Penerbangan_ID);*/
            using (var KEEntities = new HotelKasurEmpukEntities())
            {
                KEEntities.Kamar.Add(penerbangan);
                KEEntities.SaveChanges();
            }
        }
Exemple #3
0
        public void InsertProduct(MawarDBO mawar)
        {
            Kamar penerbangan = new Kamar()
            {
                kamarID = mawar.Kamar_ID,
                Jumlah  = (int)mawar.Jumlah,
                Harga   = (int)mawar.Harga,
                Jenis   = mawar.Jenis
            };

            /*Console.WriteLine(mawar.Penerbangan_ID);*/
            using (var MMEEntities = new HotelMawarMelatiEntities())
            {
                MMEEntities.Kamar.Add(penerbangan);
                MMEEntities.SaveChanges();
            }
        }
Exemple #4
0
        public KasurEmpukBDO GetProduct(int id)
        {
            KasurEmpukBDO kasurBDO = null;

            using (var KEEntities = new HotelKasurEmpukEntities())
            {
                Kamar kamar = (from p in KEEntities.Kamar
                               where p.kamarID == id
                               select p).FirstOrDefault();
                if (kamar != null)
                {
                    kasurBDO = new KasurEmpukBDO()
                    {
                        Kamar_ID = kamar.kamarID,
                        Jumlah   = (int)kamar.Jumlah,
                        Harga    = (int)kamar.Harga,
                        Jenis    = kamar.Jenis,
                    };
                }
            }
            return(kasurBDO);
        }
Exemple #5
0
        public MawarDBO GetProduct(int id)
        {
            MawarDBO mawarBDO = null;

            using (var MMEEntities = new HotelMawarMelatiEntities())
            {
                Kamar kamar = (from p in MMEEntities.Kamar
                               where p.kamarID == id
                               select p).FirstOrDefault();
                if (kamar != null)
                {
                    mawarBDO = new MawarDBO()
                    {
                        Kamar_ID = kamar.kamarID,
                        Jumlah   = (int)kamar.Jumlah,
                        Harga    = (int)kamar.Harga,
                        Jenis    = kamar.Jenis,
                    };
                }
            }
            return(mawarBDO);
        }