static public void DeleteByID(int id)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                services service = db.services.SingleOrDefault(x => x.id == id);

                var entry = db.Entry(service);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.services.Attach(service);
                }
                db.services.Remove(service);
                db.SaveChanges();
            }
        }
Exemplo n.º 2
0
        static public void DeleteByModel(string model)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                ram_memories ramModel = db.ram_memories.SingleOrDefault(x => x.model == model);

                var entry = db.Entry(ramModel);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.ram_memories.Attach(ramModel);
                }
                db.ram_memories.Remove(ramModel);
                db.SaveChanges();
            }
        }
        static public void DeleteByModel(string caseModelName)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                cases casesModel = db.cases.Where(t => t.client_order_sets.Count == 0).SingleOrDefault(x => x.model == caseModelName);

                var entry = db.Entry(casesModel);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.cases.Attach(casesModel);
                }
                db.cases.Remove(casesModel);
                db.SaveChanges();
            }
        }
Exemplo n.º 4
0
        static public void DeleteByID(int id)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                warehouse_orders order = db.warehouse_orders.SingleOrDefault(x => x.id == id);

                var entry = db.Entry(order);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.warehouse_orders.Attach(order);
                }
                db.warehouse_orders.Remove(order);
                db.SaveChanges();
            }
        }
        static public void DeleteByActivationCode(string activationCode)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                Registration registration = db.Registration.SingleOrDefault(x => x.activation_code == activationCode);

                var entry = db.Entry(registration);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.Registration.Attach(registration);
                }
                db.Registration.Remove(registration);
                db.SaveChanges();
            }
        }
Exemplo n.º 6
0
        static public void DeleteByName(string name, string surname)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                clients client = db.clients.SingleOrDefault(x => x.name == name && x.surname == surname);

                var entry = db.Entry(client);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.clients.Attach(client);
                }
                db.clients.Remove(client);
                db.SaveChanges();
            }
        }
        static public void DeleteById(int id)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                client_order_sets client_order_set = db.client_order_sets.SingleOrDefault(x => x.id == id);

                var entry = db.Entry(client_order_set);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.client_order_sets.Attach(client_order_set);
                }
                db.client_order_sets.Remove(client_order_set);
                db.SaveChanges();
            }
        }
Exemplo n.º 8
0
        static public void DeleteByName(string companyName)
        {
            using (var db = new StudiaProjektBazyDanychEntities())
            {
                wholesalers wholesaler = db.wholesalers.SingleOrDefault(x => x.company == companyName);

                var entry = db.Entry(wholesaler);
                if (entry.State == System.Data.Entity.EntityState.Detached)
                {
                    db.wholesalers.Attach(wholesaler);
                }
                db.wholesalers.Remove(wholesaler);
                db.SaveChanges();
            }
        }