public void MasaKapat(int masaID) { using (var db = new NusrETEntities()) { Masalar m = db.Masalar.Find(masaID); if (m.Statu == 1) { List <Siparisler> siparisList = MasaAktifSiparisleri(masaID); foreach (var item in siparisList) { Siparisler s = db.Siparisler.Find(item.Id); db.Siparisler.Remove(s); } List <Sepet> sepetList = MasaAktifSepetleri(masaID); foreach (var item in sepetList) { Sepet s = db.Sepet.Find(item.Id); db.Sepet.Remove(s); } m.Statu = 0; Garsonlar g = db.Garsonlar.Find(m.GarsonID); g.Statu = 0; m.GarsonID = 0; db.Entry(m).State = EntityState.Modified; db.SaveChanges(); } } }
public void SepetOnayla(int masaID) { using (var db = new NusrETEntities()) { List <Sepet> ls = db.Sepet.Where(x => x.MasaID == masaID).ToList(); List <Siparisler> ll = new List <Siparisler>(); foreach (var item in ls) { Siparisler s = new Siparisler(); s.GarsonID = item.GarsonID; s.MasaID = item.MasaID; s.SiparisZamani = DateTime.Now; s.Statu = 0; s.Adet = item.Adet; s.UrunID = item.UrunID; s.Tutar = item.Tutar; ll.Add(s); db.Sepet.Remove(item); } foreach (var item in ll) { db.Siparisler.Add(item); } db.SaveChanges(); } }
public List <Kategoriler> GetKategoriList() { using (var db = new NusrETEntities()) { List <Kategoriler> k = db.Kategoriler.ToList(); return(k); } }
public Kategoriler GetKategori(int categoryID) { using (var db = new NusrETEntities()) { Kategoriler k = db.Kategoriler.Find(categoryID); return(k); } }
public void AddKategori(Kategoriler k) { using (var db = new NusrETEntities()) { db.Kategoriler.Add(k); db.SaveChanges(); } }
public void UpdateGarson(Garsonlar g) { using (var db = new NusrETEntities()) { db.Entry(g).State = EntityState.Modified; db.SaveChanges(); } }
public List <Siparisler> GetGarsonSiparisler(int garsonID) { using (var db = new NusrETEntities()) { List <Siparisler> ls = db.Siparisler.OrderByDescending(x => x.SiparisZamani).Where(x => x.GarsonID == garsonID).ToList(); return(ls); } }
public List <Garsonlar> GetGarsonList() { using (var db = new NusrETEntities()) { List <Garsonlar> lg = db.Garsonlar.ToList(); return(lg); } }
public string GetGarsonIsim(int garsonID) { using (var db = new NusrETEntities()) { Garsonlar g = db.Garsonlar.Find(garsonID); return(g.Ad + " " + g.Soyad); } }
public Garsonlar GetGarson(int garsonID) { using (var db = new NusrETEntities()) { Garsonlar g = db.Garsonlar.Find(garsonID); return(g); } }
public void AddGarson(Garsonlar g) { using (var db = new NusrETEntities()) { db.Garsonlar.Add(g); db.SaveChanges(); } }
public void UpdateKategori(Kategoriler k) { using (var db = new NusrETEntities()) { db.Entry(k).State = EntityState.Modified; db.SaveChanges(); } }
public Masalar GetMasaWithNo(int masaNo) { using (var db = new NusrETEntities()) { Masalar m = db.Masalar.First(x => x.MasaNo == masaNo); return(m); } }
public List <Siparisler> TumSiparisler() { using (var db = new NusrETEntities()) { List <Siparisler> ls = db.Siparisler.ToList(); return(ls); } }
public List <Sepet> MasaAktifSepetleri(int masaID) { using (var db = new NusrETEntities()) { List <Sepet> ls = db.Sepet.Where(x => x.MasaID == masaID && x.Statu == 1).ToList(); return(ls); } }
public List <Siparisler> TeslimBekleyenSiparisler() { using (var db = new NusrETEntities()) { List <Siparisler> ls = db.Siparisler.Where(x => x.Statu == 0).ToList(); return(ls); } }
public Masalar GetMasa(int masaID) { using (var db = new NusrETEntities()) { Masalar m = db.Masalar.Find(masaID); return(m); } }
public List <Masalar> GetMasaListesi() { using (var db = new NusrETEntities()) { List <Masalar> lm = db.Masalar.ToList(); return(lm); } }
public void MasaEkle(Masalar m) { using (var db = new NusrETEntities()) { db.Masalar.Add(m); db.SaveChanges(); } }
public List <Siparisler> MasaTeslimEdilenSiparisler(int masaID) { using (var db = new NusrETEntities()) { List <Siparisler> ls = db.Siparisler.Where(x => x.MasaID == masaID && x.Statu == 1).ToList(); return(ls); } }
public void UrunGuncelle(Urunler u) { using (var db = new NusrETEntities()) { db.Entry(u).State = EntityState.Modified; db.SaveChanges(); } }
public List <Siparisler> MasaAktifSiparisleri(int masaID) { using (var db = new NusrETEntities()) { List <Siparisler> ls = db.Siparisler.OrderByDescending(x => x.SiparisZamani).Where(x => x.MasaID == masaID).ToList(); return(ls); } }
public List <Urunler> GetUrunList() { using (var db = new NusrETEntities()) { List <Urunler> lu = db.Urunler.ToList(); return(lu); } }
public Urunler GetUrun(int UrunID) { using (var db = new NusrETEntities()) { Urunler u = db.Urunler.Find(UrunID); return(u); } }
public void MasaSil(int masaID) { using (var db = new NusrETEntities()) { Masalar m = db.Masalar.Find(masaID); db.Masalar.Remove(m); db.SaveChanges(); } }
public void DelKategori(int categoryID) { using (var db = new NusrETEntities()) { Kategoriler k = db.Kategoriler.Find(categoryID); db.Kategoriler.Remove(k); db.SaveChanges(); } }
public void UrunEkle(Urunler u) { using (var db = new NusrETEntities()) { u.Ad = u.Ad.Trim(); u.ResimYolu = u.ResimYolu.Trim(); db.Urunler.Add(u); db.SaveChanges(); } }
public void SepetEkle(Sepet s) { using (var db = new NusrETEntities()) { Urunler u = db.Urunler.Find(s.UrunID); u.Stok = (u.Stok - s.Adet); db.Entry(u).State = EntityState.Modified; db.Sepet.Add(s); db.SaveChanges(); } }
public void MasaSepetleriSil(int masaID) { using (var db = new NusrETEntities()) { List <Sepet> ls = db.Sepet.Where(x => x.MasaID == masaID).ToList(); foreach (var sepet in ls) { db.Sepet.Remove(sepet); } db.SaveChanges(); } }
public void SepettenCikar(int sepetID) { using (var db = new NusrETEntities()) { Sepet s = db.Sepet.Find(sepetID); Urunler u = db.Urunler.Find(s.UrunID); u.Stok = (u.Stok + s.Adet); db.Entry(u).State = EntityState.Modified; db.Sepet.Remove(s); db.SaveChanges(); } }